Hacker News new | past | comments | ask | show | jobs | submit login

I once had this kind of body recovery/stress level measuring thingy on me for a few days, and a doctor would then analyze my health and such. I was under some stress those days and (according to the measurements) I wasn't recovering properly even during the nights. But then there was this one, long, flat, deep green curve in the middle of my work day. I checked from my VCS what I was doing during that period: I was optimizing.

I've since noticed this many times. Optimizing is like meditation to me. It's very mechanical (measure), with a sprinkle of creative work (once you know what is slow, it's quite obvious how to make it faster, but just challenging enough to be engaging), and it has a very nice tight feedback loop: Something is slow. I make a change. Now it's fast. Next.

Optimizing is my happy place.




I think optimization triggers fundamental instincts in humans:

1. Tracking i.e. navigating through jungles for hunting or find where the bottleneck is.

2. The thrill of the hunt. The joy after finding the hotspot or the bottleneck. It makes your day.

3. The actual hunt i.e. shooting an arrow/spear or using clever way of fixing.

4. Brag about the hunt or writing a blog post or tech talk on how difficult and awesome the hunt was.

Also optimizing a critical path has multiple takers in the org:

1. Product Managers are happy due to improved user experience.

2. Management is happy as in some cases it actually saves a lot of money.

3. Your boss is happy because he/she gets to score points as "team achievement" when evaluation is around the corner.

4. Engineers get to do nerdy things which otherwise would not find traction in the org.

All in all its a win-win-win-* situation.


Ah yes, completely unfounded behavioral "science" to explain a modern thing. My favorite.

I spent 10 years straight doing C++ and assembly optimization. My work is still fun these days but that was probably the most enjoyable work of my career in terms of the actual day to day coding.

Code cleanup in general is the same for me, but it’s really hard to justify putting much time into that when running your own company solo.


What tools did you use to assess the results of your changes?

The routines were individually benchmarked using some custom tools (iterate repeatedly and use statistical analysis to converge on an estimate). Always compared against a plain C reference implementation.

Then there was a system for benchmarking the software as a whole on a wide variety of architectures, including NUMA. With lots of plots and statistics.

Usually you’d eventually end up at a point where the improvements are below the noise floor or they help on some systems and cause regression on others. The rule was usually “no regressions”

VTune for multithreading optimization. Built a fibers and lockfree system for efficient scheduling.


That sounds like a pretty good set up with a lot of investment, HFT shop?

Codecs

I remember one fun time between jobs, that I stayed up till 4 or 5 am optimizing something. It always felt like I was making progress and about to beat the original implementation

Unfortunately I had to give up when I was still 10 times slower than the reference lol


Same here, last time I was between jobs I optimized my defunct startup's database from ~50K TPS to nearly 5M TPS (no durability, if you're wondering), and that was unbelievably rewarding.

There’s nothing quite like writing the final squashed commit message and saying “results should be bit-level identical, +25% speedup on average” or the equivalent. Even better if it’s a hot path that matters to the bottom line of the company.

I try to keep a few of these tasks lying around marked “unblocked” in case I need to unwind. It keeps me from doing it right after noticing, which is an extra bonus.



I also love optimization work. There can be a lot of creativity when it comes to reinventing how something is done. I've seen an algorithm taken to x10 after a ton of optimization by some insane SIMD techniques.

It seems there's less appreciation for this kind of work these days.


Was the need for optimization work something that was on your mind the whole time? Like a nagging feeling in the back of the head that the code is not working as well as it _should_ be working? i.e. stress.

And when you finally "fixed" the issue through optimization, your mind allowed itself to let go of these open loops (borrowing the GTD terminology), leading to relaxation?


Performance articles are often the most popular on HN. This explains why.

> Optimizing is my happy place.

Interesting. For me, it's refactoring.


I also love optimising, especially low level code.

Might explain why factorion is so popular. Not just factorion but the entire genre of games it spawned

I see you.



Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact