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

> but now you have a function call per renormalization and that has a cost that may be unacceptable.

I would go for the function, and pass along Knuth's advice about premature optimization. If you're writing at such a low level that function calls actually aren't acceptable, go with a comment "// renormalize vector." Your instinct should be the function though. I bet there is more than one vector normalization going on in this hypothetical codebase, and that line looks pretty typo-prone.




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

Search: