Skip to content

[optimization] MapStack lookup optimization #9

@bddap

Description

@bddap

MapStack is in a hot path but is uses BTreeMap under the hood.

This optimization will make MapStack insertions and deletions O(1) rather than O(log n).

Let's change MapStack to be less generic, forcing key to be usize. Next let's make sure to only use small numbers for keys.
If we ensure both of those things, we can change the BTreeMap<K, V> in mapstack to Vec<Option<V>>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions