Skip to content

Sort the ENTITIES array to allow for binary searching #14

@SabrinaJewson

Description

@SabrinaJewson

Although a binary search is slower than a hashmap lookup (on my machine, the former is 83ns, a std hashmap lookup is 16ns, while a rustc_hash hashmap lookup is 5ns), constructing a hashmap still takes a while (38μs on my machine), meaning one has to perform ~500 lookups before it becomes profitable performance-wise to use a hashmap. Since I expect most use-cases will not be parsing hundreds of entities like that (and parsing entities is not the performance bottleneck most of the time anyway), I think that allowing for direct binary search would be good.

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