Skip to content

How to take into account memory access #2513

Answered by timcassell
MartyIX asked this question in Q&A
Discussion options

You must be logged in to vote

Take 3 (I told you it's difficult!)

Code

public class BenchmarkTest
{
    private static readonly decimal[] precomputedCache = new decimal[]
    {
        1m,
        0.1m,
        0.01m,
        0.001m,
        0.0001m,
        0.00001m,
        0.000001m,
        0.0000001m,
        0.00000001m,
        0.000000001m,
        0.0000000001m,
        0.00000000001m,
        0.000000000001m,
        0.0000000000001m,
        0.00000000000001m,
        0.000000000000001m,
        0.0000000000000001m,
        0.00000000000000001m,
        0.000000000000000001m,
        0.0000000000000000001m,
    };

    [Benchmark]
    public decimal Calculate()
    {
        decimal r = 0;

        for (int 

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@timcassell

This comment has been hidden.

@timcassell
Comment options

Answer selected by MartyIX
@MartyIX
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants