--- Comment #7 from 2012-08-11 05:58:53 PDT ---
(In reply to comment #4)
> Your test is incorrectly written.
> Use one array, not an array of arrays, and use a macro to compute the r*row+c
> index.

Using your suggestions, in attach test3.c run-time is 4.84 seconds.

In D there are no macros, so I think you have to replace:

size_t cache_nc;
#define CACHE(r, c) (cache[(r)*cache_nc + (c)])

With something like:

__gshared size_t cache_nc;
ref CACHE(in size_t r, in size_t c) nothrow {
    return cache[r * cache_nc + c];

Or maybe use a custom matrix with overloaded [] and avoid global variables (but
keep global cache_nc, possibly as an enum, to keep allowing loop unrolling,
because many static compilers don't perform unrolling if they don't statically
know the loop count. JIT compilers as the Oracle Java one are able to unroll on
dynamic values too).

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to