Hacker News new | ask | show | jobs
by throwaway2016a 2919 days ago
Unless it is a hot path and the CPU is your bottle neck most of these optimizations would make the code less maintainable / less safe and I wouldn't personally do any of them.

What good is fast code if it is unmaintainable?

1 comments

What good is maintainable, easily extendable, neatly structured code when it's slow and doesn't meet the execution time criteria imposed by your client?
For most products the "time" that matters is "time to market" and "time to resolution" on bugs. Most business uses cases don't require the kind of performance we expect of them.

Depending on industry, time is relative. These optimizations will save you milliseconds on tight loops. In reality most apps aren't spending their time on tight loops. They are spending their time waiting for I/O or using inefficient algorithms. Neither of which these optimizations solve for.

If you are underperforming spec by 100ms it is likely you have one big change you need to make to save 100ms not 100 small micro-optimizations.

As you stated yourself: Most projects, not all. The 1% of project that are performance critical still matter to thousands of engineers.

Only because most people don't have to do this there are still some people that have to do optimzation where possible.

I hope you understand that optimization without profiling is worthless. Once profiling is identifying something like your datastructure as some kind of bottleneck it might be worth a shot investigating that hint.

And these kind of articles are a nice summary of work being done, giving an overview over techniques and small tweaks that you might not have thought about previously.

It is good work by the author and he deserves being recognized for it. Not being dismissed by the bland statement don't waste your time with optimization.