Skip to content

customStringToIntParser can likely be faster using a lookup table #2

@JensRantil

Description

@JensRantil

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions