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>>.