Than, after an hour of playing with print statement, I noticed I was compiling with gcc when in the past I compiled with Intel's compiler icc. I had no idea, but the types of rutines I wrote run literally ~7 times faster with icc than gcc. This is not true about all C codes, but it is about this one.
Here's a new personal testimony Intel could use:
When I don't compile my codes with Intel compilers they run so slow comparitivley that one is almost convinced there must be major bugs in the code.
It could simply be that your new compiler uses different default settings for optimizations. Take a close look at all the command line arguments and play around with them. The C compilers generate native code (vs. interpreted or byte code languages) and can be fine tuned to your particular hardware.
ReplyDeleteThe intel compiler running on intel hardware probably has default settings to optimize that combination. gcc runs on so many platforms they don't make those assumptions by default.
Have you used a profiler? If you're worried about tuning for speed a profiler can be invaluable. Often times our human assumptions about bottlenecks are just wrong.
Stan,
ReplyDeleteThanks for the points, and you're probably right. This is a new Intel machine with new Intel compilers. Furthermore the version of gcc is years older than the hardware it's on.
It probably is something to do with optimizations the Intel compiler is doing that gcc isn't/can't/