Compact MJIT methods to single so file #1921
Closed
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.
This is for https://bugs.ruby-lang.org/issues/14490.
Changes
In some conditions, this patch compacts all .o files to one .so file and load all methods from it again to improve memory locality of generated code. As this is an experimental version, MJIT attempts the compaction and reload only when one of following conditions are met:
Benchmark
In this benchmark, I'll compare following four conditions:
Micro benchmark
Using this script https://gist.github.com/k0kubun/10e6d3387c9ab1b134622b2c9d76ef51, calls some amount of different methods that just return
nil
. The following tables are its average duration seconds of 3 measurements.Smaller is better.
1 method (seconds)
50 methods (seconds)
1500 methods (seconds)
Discourse
Using the same benchmark strategy as https://bugs.ruby-lang.org/issues/14490 with this branch forked from discourse v1.8.11 to support running trunk.
Response time (ms)
Here is the response time milliseconds for each percentile. Skipping 99%ile because it's the same as 100%ile in 100 calls.
Ratio (smaller is better)
Here is the response time increase ratio against no-JIT trunk's one. Bold results are ones faster than no-JIT trunk.