use li->roots instead of module constant table #14656
Merged
+10
−25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Looking at #14556, I experimented with (1) disabling AST compression, and (2) returning constant tables to per-function instead of per-module. Here is the data:
With the new GC, AST compression is not as crucial as it used to be. Performance is on par (some things were faster and some were slower) but memory use is way higher. However using function-local constant tables wins hands-down by removing most of the O(n^2) constant lookup while retaining the benefits of compression. The only benefit of per-module constant tables is system image size, but not by much. Also I suspect if the common symbols lists were recomputed for the no-compression case its system image would improve a lot.
The subarray test accounts for almost all of the improvement; it got ~100s faster. In that test the constant tables are huge, and consist almost entirely of types. In the no-compression case the subarray test is also 100s faster than master.
So for now I recommend ripping out the per-module constant table since it's an easy win. Long term, we should get rid of AST compression by addressing memory use in that case. Ideas there: