logoalt Hacker News

aapplebytoday at 6:48 AM2 repliesview on HN

This is... not an example of good optimization.

Focusing on micro-"optimizations" like this one do absolutely nothing for performance (how many times are you actually calling Instance() per frame?) and skips over the absolutely-mandatory PROFILE BEFORE YOU OPTIMIZE rule.

If a coworker asked me to review this CL, my comment would be "Why are you wasting both my time and yours?"


Replies

thomasmgtoday at 7:14 AM

Optimizing requires a (performane) problem, and often needs a benchmark.

In my view, the article is not about optimizing, but about understanding how things work under the hood. Which is interesting for some.

delusionaltoday at 8:11 AM

> If a coworker asked me to review this CL, my comment would be "Why are you wasting both my time and yours?"

If a coworker submitted a patch to existing code, I'd be right there with you. If they submitted new code, and it just so happened to be using this more optimal strategy, I wouldn't blink twice before accepting it.