Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Maybe the compiler needs to see the whole function in order to properly optimize register usage, because the function is on the critical path.

There is sometimes more to code than readability, unfortunately. I have worked with functions thousands of lines long that can't be broken up without losing a few percentage points of speed - but these functions are called millions of times.



It's always a matter of heuristics, for sure. When you need to modify code in a way that's less than readable/obvious, then you start dropping in comments to compensate. Your first pass should be understandable and obvious and readable, with comments typically restricted to documenting functions and interfaces.


Effective use of macros or inlining could solve that problem.


Over 2,000 lines with macros. Inlining didn't give good enough results (at the time).




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

Search: