logoalt Hacker News

boersethyesterday at 5:47 PM2 repliesview on HN

That's a long list of numbers that seem oddly specific. Apart from learning that f-strings are way faster than the alternatives, and certain other comparisons, I'm not sure what I would use this for day-to-day.

After skimming over all of them, it seems like most "simple" operations take on the order of 20ns. I will leave with that rule of thumb in mind.


Replies

aunderscoredyesterday at 9:23 PM

If you're interested, fstrings are faster because they directly become bytecode at compile time rather than being a function call at runtime

show 1 reply
0x000xca0xfeyesterday at 6:09 PM

That number isn't very useful either, it really depends on the hardware. Most virtualized server CPUs where e.g. Django will run on in the end are nowhere near the author's M4 Pro.

Last time I benchmarked a VPS it was about the performance of an Ivy Bridge generation laptop.

show 1 reply