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

Broadly speaking, it's removing flow control from the code in order to make it easier to read or faster to execute.

In this case, I think he's replaced function calls with the body of those functions. For example, "displayrooms" is immediately followed by { } surrounding the contents of what "displayrooms" actually does: interpolate, animate, and so on. This means you can read just the one source file and know what's being executed, instead of having to read the source of displayrooms.c and various other source files separately.

Another common form of "unrolling" is repeating the body of a loop some number of times. See, for example, http://en.wikipedia.org/wiki/Duff%27s_device . Basically, by reducing the number of branches (and therefore potential pipeline flushes) you can decrease computation time.



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: