Warp wrote:
> I was curious to see how much of a difference sqrt() really makes compared
> to avoiding it, so I made this C++ file:
> I compiled with "-O3 -march=native" and got this result:
>
> circlesCollide1: 200000000 iterations took 16.23 seconds.
> circlesCollide2: 200000000 iterations took 5.42 seconds.
I would imagine this sort of thing varies by processor, but yeah... I'm
often curious to know how "expensive" various math operations are in
relation to each other. (Of course, real programs are also affected by
cache issues and which combinations of math ops you perform together and
branch prediction issues and so forth... But typically you can't do much
about that.)
Post a reply to this message
|