|
|
|
|
|
by MattPearce
4259 days ago
|
|
The C code is quite unoptimised as well... Running the original on my machine (compiled with VS2013) takes 3.75 seconds. Changing the comparison to (x * x + y * y) <= 1.0 (no need for the sqrt since we are comparing with 1!) takes the runtime down to 2.87 seconds. Switching the accumulation from a branch to hits+=in_circle(r1, r2) further reduces it to 2.43 seconds. |
|