The smartest people I’ve ever worked with to date were from physics grad school. Still remember the time my coworker was doing code profiling, decided he was unhappy that the exponential function from the standard library was too slow, and decided to write a Taylor series approximation that gave him the precision he needed and cut the run time in half. He also learned C++ in a weekend and was vastly better at it by the end of that weekend than most people I’ve met in industry. And these were just every day occurrences that made it a thrill to go to work. Working with talented people is a drug.
Some tips for younger people considering it: get involved in undergraduate research, apply to fellowships, shop for an advisor with a good reputation, start anticipating and preparing for an industry transition early, travel, date, and enjoy life!
I don't want to take away from his brilliance, but generally Taylor approximations perform far worse than the standard library implementations. It's also the first tool of choice for physicists, so who knows ...?
My guess, though, is that if he improved the performance, he used some other wizardry (Chebyshev or something similar).
I think Carmack credits someone else as the origin - possibly some magazine entry.
These days I think the reciprocal square root intrinsic is the fastest where precision is not that important.
I think there was a bit twiddling hack for pop count which was consistently faster than the equivalent cpu intrinsic due to some weird pipelining effect, so sometimes it is possible to beat the compilers and intrinsics with clever hacks.
If he already knew how to code in other object oriented languages, and was really just learning C++ syntax over the weekend, it’s not as much of a stretch.
C++ is one of the most flexible and unopinionated languages you could ever encounter.
The idea that someone who knows a high-level object-oriented language could translate that to immediate success in low-level C++ syntax at a level higher than the experts that developed the libraries over a weekend is frankly fantastical.
> the experts that developed the libraries over a weekend is frankly fantastical.
this is not synonymous with "most [C++ programmers] in industry"
The claim was the person learned it better than most people in industry, not most people writing the libraries upon which the industry is based
EDIT: Also we don't technically know when this happened. If this story is from the 1990s, it's a lot more likely, because think of how many shitty C++ programmers there were back then since we didn't have all the language options we do now. It was still the language taught in schools, for example. Then it was Java and Python and JS etc. But back then, Jonny Mackintosh was writing bad C++ out of uni.
Some tips for younger people considering it: get involved in undergraduate research, apply to fellowships, shop for an advisor with a good reputation, start anticipating and preparing for an industry transition early, travel, date, and enjoy life!