Description
Currently our Name
s are just SmolStr
ings, which are 24 bytes in size which is pretty massive. They are also not interned at all, merely a fancy Arc so we can (and most likely do) have a lot of the same names allocated in different Arcs as well.
It's unclear (to me at least) what a good solution here is (that would make things a bit more performant). We can't do it the "standard way" of just interning things (into a global/singleton) and returning an index, as that would effectively leak memory over time, so the most likely thing to do would be to probably stick with an Arc
, do by identity equality and properly intern through an interner to deduplicate. If we go with a thin arc we'd cut down the size of Name
s to 8 bytes.
Another option would be to use salsa for interning. This might work fine but I fear that will have a pretty severe performance hit, as we are already struggling with salsa taking a long time to revalidate queries.