Experiment splitting declaration and definition storage
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 355
- Forks
- 24
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 17
Description
We currently store all declarations and definitions in their respective maps, which is part of the reason why we need to use u64 rather than u32 for IDs.
I think we may be able to change that situation if we partition the maps. One example of how we might do it is:
constants: IdentityHashMap<ConstantId, Declaration>all constants including namespacesmethods: IdentityHashMap<MethodId, Declaration>all methodsvariables: IdentityHashMap<VariableId, Declaration>global, class and instance variables
Experimenting with the granularity may also reveal interesting trade offs. The only concern is that we need to be able to trace the graph from the top (declarations) and from the bottom (documents).
- From the top, we need to be able to derive the entity kind from the name. By looking at
Foo, we don't know if it's a constant, constant alias, module, class. So having a singleConstantIdprobably makes sense. However, we always know when something is a method, global, class or instance variable. So we could get very granular if that proves to reduce memory or yield better performance - From the bottom, we always know how a definition gets connected to its declaration, so it's straight forward
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by locating the declaration and definition maps and the ID types, then trace how the graph is followed from declarations and documents. Done should include a measured evaluation of the partitioning experiment and a clear decision on whether to adopt it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby, rust
- Domain
- devtools
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100