You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a look at https://github.com/shraddhaag/1brc/blob/8513d5e70a1bfabbf46ab86a9cb6558bc9805154/main.go#L240C6-L240C29. Given that the temperatures are always within [-99.9, 99.9] and you know that it always has a tenth of accuracy, you can build up a string -> int lookup table on startup of your application. The lookup table will hold 1999 items. That way, parsing will be looking up the string in the lookup table. My gut feeling is this will be faster.
Caveat: I have not looked at the raw data file, nor have a ran the program.
The text was updated successfully, but these errors were encountered:
JensRantil
changed the title
customStringToIntParser can likely be faster using a lookup tablecustomStringToIntParser can likely be faster using a lookup table
Feb 25, 2024
I had a look at https://github.com/shraddhaag/1brc/blob/8513d5e70a1bfabbf46ab86a9cb6558bc9805154/main.go#L240C6-L240C29. Given that the temperatures are always within [-99.9, 99.9] and you know that it always has a tenth of accuracy, you can build up a
string -> int
lookup table on startup of your application. The lookup table will hold 1999 items. That way, parsing will be looking up the string in the lookup table. My gut feeling is this will be faster.Caveat: I have not looked at the raw data file, nor have a ran the program.
The text was updated successfully, but these errors were encountered: