Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is actually a great example of something I see in the wild. The most common I've seen are lookup tables for trig functions that are only as fast or even slower than math.h.

You have to aggressively benchmark even across CPU generations to remain confident that your optimization has optimized anything.



Nowadays, most of the math code I worry about I throw into godbolt with -O3 then check the major instructions on Agner Fog. It's often immediately obvious that a modern compiler+CPU is already using a tiny number of cycles to do what I want. (One exception is hot paths that might need to be optimized by hand to use SIMD intrinsics.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: