-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Problem
Semantic
uses a struct of arrays pattern for ScopeTree
and other structures.
If we do oxc-project/oxc#4269, then ScopeTree
would be purely a collection of IndexVec
s. Then we can optimize it.
At present we treat all 6 x IndexVec
s as independent. When creating a scope, we push to each vec independently.
This is inefficient in 3 ways:
len
andcapacity
are stored 6 times. They only need to be stored once, as they're the same for all 6 vecs.- Each time we add a scope,
IndexVec::push
looks uplen
for that vec, checks if it's at capacity, and grows if required. These lookups/checks happen 6 times, when they only need to happen once. - Looking up multiple pieces of information about a scope will involve multiple bounds checks, when only 1 is required.
Potential solution
Find a crate which optimizes SOA structures to avoid these penalties. Hopefully one exists, but if not, create one.
Metadata
Metadata
Assignees
Labels
No labels