News for hackers. Stuff that matters.
Re:Are PhDs losing lustre? Why fewer students are enrolling ... by morelandjs on Thursday February 13, 2025 @11:28AM (#43037685)
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!

Re:Are PhDs losing lustre? Why fewer students are enrolling ... by BeetleB on Thursday February 13, 2025 @04:13PM (#43041434)
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).

Re:Are PhDs losing lustre? Why fewer students are enrolling ... by whatshisface on Thursday February 13, 2025 @04:28PM (#43041615)
Sometimes what you need is less precision, much faster. Carmack's famous inverse square root falls into this category.

If anything it's a lesson that the definition of brilliance is being in the wrong place at the wrong time... ;-)

Re:Are PhDs losing lustre? Why fewer students are enrolling ... by michaelcampbell on Thursday February 13, 2025 @04:57PM (#43041909)
Carmack denied writing it, and if WP is to be believed, he didn't.

https://en.wikipedia.org/wiki/Fast_inverse_square_root

Re:Are PhDs losing lustre? Why fewer students are enrolling ... by cjbgkagh on Thursday February 13, 2025 @04:53PM (#43041874)
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.

Re:Are PhDs losing lustre? Why fewer students are enrolling ... by dingnuts on Thursday February 13, 2025 @04:31PM (#43041649)
Honestly the whole story sounds like a tall tale to me.

> 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

I doubt this. Really, really doubt this. Sure, geniuses exist, but I don't buy it.

Re:Are PhDs losing lustre? Why fewer students are enrolling ... by null_shift on Thursday February 13, 2025 @04:48PM (#43041821)
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.
Re:Are PhDs losing lustre? Why fewer students are enrolling ... by cudgy on Thursday February 13, 2025 @05:19PM (#43042167)
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.

Re:Are PhDs losing lustre? Why fewer students are enrolling ... by KPGv2 on Thursday February 13, 2025 @05:45PM (#43042440)
> 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.

Re:Are PhDs losing lustre? Why fewer students are enrolling ... by lazyasciiart on Thursday February 13, 2025 @07:00PM (#43043029)
Also it's constrained to "most people I've met in industry". If OP doesn't work with C++ developers...
Re:Are PhDs losing lustre? Why fewer students are enrolling ... by ikrenji on Thursday February 13, 2025 @06:31PM (#43042833)
prob why there is so much garbage C++ code. someone needs to set the right way of doing things
Re:Are PhDs losing lustre? Why fewer students are enrolling ... by thorin on Friday February 14, 2025 @08:11AM (#43047946)
It's more likely that he was a decent C developer and learnt the basics of C++ and then ignored most of it.

C++ --

Re:Are PhDs losing lustre? Why fewer students are enrolling ... by mrguyorama on Thursday February 13, 2025 @04:46PM (#43041797)
Having seen physicists code, I REALLY doubt this.
Re:Are PhDs losing lustre? Why fewer students are enrolling ... by BeetleB on Thursday February 13, 2025 @05:14PM (#43042113)
Bah! Let's go invert the matrix!
Re:Are PhDs losing lustre? Why fewer students are enrolling ... by fooker on Thursday February 13, 2025 @08:31PM (#43043649)
The standard library implementations use Taylor approximations
Re:Are PhDs losing lustre? Why fewer students are enrolling ... by morelandjs on Thursday February 13, 2025 @10:02PM (#43044314)
https://github.com/Duke-QCD/trento/blob/master/src/fast_exp....

Check it out for yourself! I’m not claiming this was some kind of prodigious programming move, just something memorable that stuck with me.

Re:Are PhDs losing lustre? Why fewer students are enrolling ... by DrFalkyn on Friday February 14, 2025 @01:24AM (#43045469)
Looks like he’s using a lookup table based on std::exp in combo with the Taylor expansion
Re:Are PhDs losing lustre? Why fewer students are enrolling ... by adastra22 on Friday February 14, 2025 @02:07AM (#43045694)
The smartest people I’ve ever worked with were college dropouts.