manifold-lang / manifold-core

Core library for Manifold frontends and backends
GNU General Public License v3.0
5 stars 7 forks source link

refactor: use a bijective structure for forward-reverse maps #27

Open mtrberzi opened 10 years ago

mtrberzi commented 10 years ago

There are a lot of places in the intermediate where we need to be able to look up a value given its key, and also look up a key given its value. Currently we are maintaining two maps (or performing an expensive linear search) everywhere this is done.

I know that at least Apache Commons and Guava have implementations of a bidirectional map (bijective structure). I think it would be a good enhancement to use this structure instead wherever both forward and reverse lookup need to be performed.