Re:1BRC Merykitty's Magic SWAR: 8 Lines of Code Explained in...
by robin_reala on Saturday March 09, 2024 @12:14PM
(#39653082)
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.
[ Parent
| on HN ]
Re:1BRC Merykitty's Magic SWAR: 8 Lines of Code Explained in...
by __float on Saturday March 09, 2024 @02:15PM
(#39654011)
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...
Re:1BRC Merykitty's Magic SWAR: 8 Lines of Code Explained in...
by haxen on Saturday March 09, 2024 @02:19PM
(#39654043)
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.