top | item 38858356

(no title)

useerup | 2 years ago

I believe because the C# version has been written using rectangular arrays. This requires every array access to use a multiplication. The Java version uses array-of-arrays and hoisting the inner array out before accessing it in the inner loop.

C# also has arrays-of-arrays, and could (should) be written in the same manner.

discuss

order

iruoy|2 years ago

I've just done this and it has been merged. The benchmarks table and image haven't been updated yet. But this should bring the C# result to ~2s instead of 4.67s

akashcoach|2 years ago

Thanks for the explanation. Yes this make sense to me.