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

That’s explained at the end of the post: in the real code, that’s the most efficient place to calculate it, and it was passed back out as well.



That was some key context lost in the simplification of the original code[1] for this blog post, though. The blog post's code returns the temperature (throwing away the next line), whereas the original adds it to a map and returns the next line.

[1] https://github.com/gunnarmorling/1brc/blob/dfec2cdbe6a0334cf...


There are many variations of the original code used in different solutions. Many of them return the temperature like the variant used in the post, but they split out the part that finds the decimal dot into a separate function. Then you can reuse that twice: to finish parsing the temperature, and to advance the cursor to the next row.




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

Search: