-
-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(semantic): track cfg index per ast node #2210
feat(semantic): track cfg index per ast node #2210
Conversation
CodSpeed Performance ReportMerging #2210 will degrade performances by 3.02%Comparing Summary
Benchmarks breakdown
|
You’re doing a ton more work to store these in a hashmap still, maybe its worth making this an indexmap using the same AstNodeId as keytype? Still you are doing a lot more work and there will be a perf regression here. I’d be curious to know what specific new usecase this enables. |
95ac891
to
0797478
Compare
Now that I have write access, I will try to use graphite inside of oxc directly to manage PR chains. I was doing this part in my own fork, but you can see my WIP of using this code in TzviPM#5. That PR is currently failing because of CFG issues (I think) and I will tune the performance of this PR once I have the use case working as well. |
I think the problem is 2-fold:
|
At the end of the day, I'm not calculating anything extra, just storing an association that's already calculated. Im sure there's a way to do this without a 40% performance degredation. |
Ooh, what if the ast node was actually not a u32, but actually a u24 with a u8. Basically, we always create an ast node before a node index, and then we associate the ast node with the created index. If we create the index first, then every time we make a node, we store it's ID as the node index (currently 32 bits, but just 24 bits might be enough) followed by an ast node inner index which denotes the position of the ast node within the CFG node. In this way, we don't need to store any additional data on the heap, just make some in-register calculations to go from an ast node ID to the CFG node index. |
Changed to draft due to performance regression. Please excuse me for not understanding any of this right now. The only blocker from myside is the performance regression and nothing else. |
TzviPM#6 is the downstream PR that implements no_this_before_super. Now that I have everything wired up trivially, I will start tweaking the solution to fix the performance regression. |
2617dd0
to
6ef24c1
Compare
6ef24c1
to
df491c8
Compare
My initial removing of the conditional ended up always double-setting the function nodes. I fixed that by simply re-ordering. Then, instead of having a separate node map, I tried storing the cfg index right on the astnode of the semantic struct. This also makes more sense to me in terms of separation of concerns and boosted performance dramatically. |
df491c8
to
80a3140
Compare
80a3140
to
25385be
Compare
This allows looking up a cfg index from an ast node in a semantics return. This allows later passes to better make use of the cfg.
This allows looking up a cfg index from an ast node in a semantics return. This allows later passes to better make use of the cfg.