food for thought - swift 5 released - bottom types, string interpolation, and stuff.
jmh530
john.michael.hall at gmail.com
Fri Apr 12 11:12:15 UTC 2019
On Friday, 12 April 2019 at 10:52:00 UTC, Patrick Schluter wrote:
> [snip]
>
> funny you mention abs(). My current job was enabled because the
> project leader was impressed with my optimisation skill. The
> first change I made in the code base (in the Levenshtein
> routine) was to replace the call to abs() by a macro doing
> nothing more fancy than "n>0?n:-n". The gain in performance was
> so massive, it completely floored me at that time. People
> underestimate the cost of a call, especially into a dynamic
> library (it is an indirect jump via the GOT), if it is in the
> hot loop it can be a massive cycle waster.
>
Was this C code (based on the reference to macros)? Could you get
the same performance boost by pulling abs out into a static
library?
More information about the Digitalmars-d
mailing list