A faster way to convert a timestamp to Hour, Min, Sec

76 points by benjoffe


TotallyAsymetricSymbol

Nicely explained. Extensively tested. The content is presented in a clear and visually appealing way. I really love it! <3

Timwi

As someone more into high-level programming, I've always found it quite nebulous the performance characteristics of low-level operations such as these. Here I am thinking that division and modulo are single processor instructions and therefore the most optimal possible, and then an article like this comes along to give me a reality check.

It makes me wonder how much of what I think I know about compiled code is actually true. I try to avoid unnecessary allocations for performance but then, who knows, maybe for some reason I'm unaware of, some allocations are sometimes actually more optimal because of some other subtlety.

If you take this to the logical extreme, the same is true of every level of abstraction, from the way the compiler generates machine code all the way to how your GUI library is implemented.

No wonder software is slow.