(April 24, 2016 at 7:21 am)Cthulhu Dreaming Wrote:(April 24, 2016 at 5:42 am)pocaracas Wrote: C++, it was.
And the purpose of it was to prevent function calls, added stack, and variable copying/passing.
We may think of those as "fast" events, but when every CPU cycle is precious, any trick is valid... Even if the CPU is an Octa-core, with hyperthreading and churning at some 3.6 GHz (a Xeon, I think it was).
I've only had to adapt a simple script in Perl, so I can't say much about it.
I'm guessing those pre-processor macros define inline functions - from what you've described.
I never personally got into C++, I did a little bit professionally but I'm far from expert. I would guess 80% of my career has been ANSI C, with most of the rest being Perl and Java.
I definitely agree that in your line of work avoiding a couple of stack operations, etc should be eschewed for keeping it in registers. I can imagine you have data analysis jobs that take hours or days to run. Every optimizion counts when you iterate over that much data.
Of course you already know this, this is more meant for other readers.
When working on something that may take a long time to process, we use IDL or Python, or Matlab... much easier to code in... and, of course, it then takes longer to process (than if it was written in C... or even JAVA).
There are some applications that must run "in real time"... acquire data, process it and provide some output that drives something to act upon the plasma... and the processing must be accomplished in less than a preset time - we usually operate either with 50 or 100 microseconds.
For these, yes, we turned off hyperthreading, fixed the linux kernel (if it works with one, stick with it!), used cpu core isolation (with the isolcpu setting in GRUB) and assigned the process to run on those isolated CPUs with taskset.