Skip to content

Proper name interning #15590

Closed
Closed
@Veykril

Description

@Veykril
Member

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.

Activity

added
C-ArchitectureBig architectural things which we need to figure up-front (or suggestions for rewrites :0) )
A-perfperformance issues
on Sep 9, 2023
self-assigned this
on Sep 22, 2023
added a commit that references this issue on Jul 15, 2024

Auto merge of #17584 - Veykril:landing-page, r=Veykril

added a commit that references this issue on Jul 28, 2024

Auto merge of rust-lang#17584 - Veykril:landing-page, r=Veykril

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

    Participants

    @Veykril

    Issue actions

      Proper name interning · Issue #15590 · rust-lang/rust-analyzer