Run memory comparison script between Prism and Sorbet #243
+201
−2
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.
Motivation
Now that we can run the entire Sorbet pipeline on the RBI gem, we can include it in our benchmarks. Here, I've updated the memory comparison script to run on the RBI gem, and then committed the results of running the script.
Results
The results here have held consistent. When just comparing the memory usage of the two parsers, Prism uses about 65% as much memory as the Sorbet parser. When running the entire pipeline, the results are less dramatic because we run the translation layer, which will allocate the same Sorbet nodes as the Sorbet parser, thus evening out the results.
**Note: ** There might also be another stage in the Sorbet pipeline that allocates more memory than the parser, in which case the results of the latter two benchmarks will return peak memory in that stage. However, even if that's true, the fact that these numbers are similar is still promising, because it means that even with the translation layer, Prism isn't causing Sorbet to use more memory than it normally does at its peak.