Re:4B If Statements
by Centigonal on Thursday December 28, 2023 @01:40AM
(#38790732)
Software development needs to be driven by user needs. Clearly the best action in this scenario is to bundle in telemetry code that reports back which numbers are used with this program, assemble a ranking of the most frequently compared numbers in the real world, and use that to order the comparisons in v2 of the program.
[ Parent
| on HN ]
Re:4B If Statements
by chrismorgan on Thursday December 28, 2023 @03:07AM
(#38791145)
It’s worth noting that good compilers can actually do a version of this: it’s called profile-guided optimisation <https://en.wikipedia.org/wiki/Profile-guided_optimization>. Not many projects use it, because it’s generally a bit of a bother (build a special version, run your profiling, then build everything all over again), but Firefox gets good mileage out of it. My vague recollection is a typical sort of speedup of 5%.
Don't forget to remove the least used 1% of the numbers to make it leaner!
Of course the modern "scaleable" solution is to ask ChatGPT if the number is even or odd, and then print ChatGPT's response.
Re:4B If Statements
by constantly on Thursday December 28, 2023 @02:24AM
(#38790938)
Using selenium and chrome webdriver under the hood to do so, as well.