Skip to content

Proper name interning #15590

Closed
Closed
@Veykril

Description

@Veykril

Currently our Names are just SmolStrings, 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 Names 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.

Metadata

Metadata

Assignees

Labels

A-perfperformance issuesC-ArchitectureBig architectural things which we need to figure up-front (or suggestions for rewrites :0) )E-hard

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions