-
Notifications
You must be signed in to change notification settings - Fork 14
Description
In order to guide the development of YJIT, we perform a fair number of small experiments. However, we do so many of these, that it becomes hard to remember them all and keep track of all the documents, issues, etc. I'm opening this issue so we can gather keep track of the experiments we perform, the data we gather, and the takeaways we come to.
I'm going to pin this issue. You should be able to edit this comment to add to the list, or comment on the issue. Please include links to relevant documents, issues or PRs, and try to summarize takeaways in one or two sentences :)
Method calls
Call frequency and call types in yjit-bench
Takeaway: C method calls are the most popular. Block calls don't happen that often compared to them.
Reducing interp_return by rewriting Array#each in Ruby
Takeaway: It reduces interp_return by 3%. But it doesn't give a speedup overall.
JIT ABI to return multiple values
Takeaway: No impact on railsbench, liquid-render speeds up by 1~2%. Not worth the complexity.
Memory usage
Memory used by YJIT Rust
Takeaway: Reducing the number of Blocks and Branches is the key. Context uses only 10~15% of all memory usage.
Distribution of Context objects on railsbench
https://gist.github.com/k0kubun/c1a5854e011db90d7e6efd73a6eda3b3
Takeaway: Contexts are currently very sparse, most types are unknown. There's definitely room for memory savings.
Context memory saving experiments
- master: 9.19MB (±0%)
- Packed Context: 8.89MB (-3.3%) YJIT: Packed Context ruby/ruby#7279
- Deduplicated Context: 8.80MB (-4.2%) YJIT: Deduplicated Context ruby/ruby#7332
- Deduplicated Packed Context: 8.95MB (-2.6%) YJIT: Deduplicated Packed Context ruby/ruby#7360
- Hash Consing Context: 9.38MB (+2.1%) YJIT: Hash Consing Context ruby/ruby#7359
Takeaway: Deduplicating Context with HashSet<Rc<Context>> works the best. But it might change as Context changes.