[pull] master from ruby:master#823
Merged
pull[bot] merged 10 commits intoturkdevops:masterfrom Mar 4, 2026
Merged
Conversation
The former is the specialized case of the latter.
For Shopify#822 Adds a small script for automatically running benchmarks between two git refs. Example output (doubled an increment to `inline_cfunc_optimized_send_count` to illustrate stat diffs): ``` $ ./zjit_diff --before master I, [2026-03-03T10:24:52.691660 #48554] INFO -- : Existing worktree found at /var/folders/l_/p20zlp5j3wx76vr9ggzgzcmr0000gn/T/ruby-zjit-before HEAD is now at 7a3940e Unify rb_node_list_new and rb_node_list_new2 I, [2026-03-03T10:24:52.729815 #48554] INFO -- : Found existing build for master, skipping build I, [2026-03-03T10:24:52.729881 #48554] INFO -- : Existing worktree found at /var/folders/l_/p20zlp5j3wx76vr9ggzgzcmr0000gn/T/ruby-zjit-after HEAD is now at 3859f12966 dup I, [2026-03-03T10:24:52.801287 #48554] INFO -- : Found existing build for HEAD, skipping build I, [2026-03-03T10:24:52.801354 #48554] INFO -- : Running benchmarks I, [2026-03-03T10:24:52.801404 #48554] INFO -- : ruby-bench already cloned, pulling from upstream <... benchmark run logs ...> before: ruby 4.1.0dev (2026-03-03T14:05:00Z master 7a3940e) +ZJIT dev +PRISM [arm64-darwin25] last_commit=Unify rb_node_list_new and rb_node_list_new2 after: ruby 4.1.0dev (2026-03-03T15:17:20Z :detached: 3859f12966) +ZJIT dev +PRISM [arm64-darwin25] ---------- ------------- ------------- ------------- ------------ bench before (ms) after (ms) after 1st itr before/after lobsters 747.9 ± 2.9% 757.7 ± 2.4% 0.983 0.987 railsbench 1183.4 ± 1.9% 1214.5 ± 2.4% 1.001 0.974 (*) ---------- ------------- ------------- ------------- ------------ Legend: - after 1st itr: ratio of before/after time for the first benchmarking iteration. - before/after: ratio of before/after time. Higher is better for after. Above 1 represents a speedup. - ***: p < 0.001, **: p < 0.01, *: p < 0.05 (Welch's t-test) Output: data/zjit_diff.json ================================================================================ ZJIT Stats Comparison ================================================================================ before (baseline): ruby 4.1.0dev (2026-03-03T14:05:00Z master 7a3940e) +ZJIT dev +PRISM [arm64-darwin25] last_commit=Unify rb_node_list_new and rb_node_list_new2 after: ruby 4.1.0dev (2026-03-03T15:17:20Z :detached: 3859f12966) +ZJIT dev +PRISM [arm64-darwin25] BENCHMARK TIMINGS (lower is better) -------------------------------------------------------------------------------- lobsters: before avg: 0.748s min: 0.706s ★ (baseline) after avg: 0.758s min: 0.735s +1.3% (slower) railsbench: before avg: 1.183s min: 1.158s ★ (baseline) after avg: 1.214s min: 1.182s +2.6% (slower) MEMORY USAGE -------------------------------------------------------------------------------- lobsters: before maxrss: 548.3MB zjit_mem: 68.6MB after maxrss: 520.8MB zjit_mem: 68.3MB railsbench: before maxrss: 208.3MB zjit_mem: 29.3MB after maxrss: 205.7MB zjit_mem: 29.3MB SEND COUNTERS (showing differences > 5.0%) -------------------------------------------------------------------------------- lobsters: inline_cfunc_optimized_send_count 64,066,387 ( 37.3%) → 105,498,619 ( 61.4%) ▲ +64.7% optimized_send_count 136,557,743 ( 79.5%) → 177,989,922 (103.6%) ▲ +30.3% send_count 171,791,578 (100.0%) → 213,223,697 (124.1%) ▲ +24.1% railsbench: inline_cfunc_optimized_send_count 130,638,873 ( 36.3%) → 225,643,322 ( 62.8%) ▲ +72.7% optimized_send_count 306,690,230 ( 85.3%) → 401,694,689 (111.8%) ▲ +31.0% send_count 359,393,477 (100.0%) → 454,397,936 (126.4%) ▲ +26.4% SUMMARY COUNTERS (showing differences > 5.0%) -------------------------------------------------------------------------------- railsbench: invalidation_time 7ms → 7ms ▲ +5.3% COMPILE HIR PASS TIMINGS (showing differences > 5.0%) -------------------------------------------------------------------------------- lobsters: eliminate_dead_code_time 245ms → 232ms ▼ -5.3% ```
When that call fails, the `bn` BIGNUM is never freed in asn1integer_to_num(). To solve this, use rb_protect(). Example Valgrind report: ``` 32 (24 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record 11,113 of 25,910 malloc (at /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) CRYPTO_zalloc (at /usr/lib/x86_64-linux-gnu/libcrypto.so.3) BN_new (at /usr/lib/x86_64-linux-gnu/libcrypto.so.3) BN_bin2bn (at /usr/lib/x86_64-linux-gnu/libcrypto.so.3) <unknown stack frame> *asn1integer_to_num (ossl_asn1.c:136) *asn1integer_to_num_i (ossl_asn1.c:165) rb_protect (at /usr/lib/x86_64-linux-gnu/libruby-3.2.so.3.2.3) *decode_int (ossl_asn1.c:356) *int_ossl_asn1_decode0_prim (ossl_asn1.c:777) *ossl_asn1_decode0 (ossl_asn1.c:936) *ossl_asn1_decode_all (ossl_asn1.c:1058) <unknown stack frame> <unknown stack frame> <unknown stack frame> rb_vm_exec (at /usr/lib/x86_64-linux-gnu/libruby-3.2.so.3.2.3) <unknown stack frame> <unknown stack frame> rb_catch_obj (at /usr/lib/x86_64-linux-gnu/libruby-3.2.so.3.2.3) <unknown stack frame> <unknown stack frame> <unknown stack frame> rb_vm_exec (at /usr/lib/x86_64-linux-gnu/libruby-3.2.so.3.2.3) rb_yield (at /usr/lib/x86_64-linux-gnu/libruby-3.2.so.3.2.3) rb_ary_each (at /usr/lib/x86_64-linux-gnu/libruby-3.2.so.3.2.3) <unknown stack frame> <unknown stack frame> <unknown stack frame> rb_vm_exec (at /usr/lib/x86_64-linux-gnu/libruby-3.2.so.3.2.3) rb_yield (at /usr/lib/x86_64-linux-gnu/libruby-3.2.so.3.2.3) rb_ary_each (at /usr/lib/x86_64-linux-gnu/libruby-3.2.so.3.2.3) <unknown stack frame> <unknown stack frame> <unknown stack frame> rb_vm_exec (at /usr/lib/x86_64-linux-gnu/libruby-3.2.so.3.2.3) rb_yield (at /usr/lib/x86_64-linux-gnu/libruby-3.2.so.3.2.3) rb_ary_each (at /usr/lib/x86_64-linux-gnu/libruby-3.2.so.3.2.3) <unknown stack frame> <unknown stack frame> <unknown stack frame> rb_vm_exec (at /usr/lib/x86_64-linux-gnu/libruby-3.2.so.3.2.3) <unknown stack frame> <unknown stack frame> rb_catch_obj (at /usr/lib/x86_64-linux-gnu/libruby-3.2.so.3.2.3) <unknown stack frame> <unknown stack frame> <unknown stack frame> rb_vm_exec (at /usr/lib/x86_64-linux-gnu/libruby-3.2.so.3.2.3) rb_vm_invoke_proc (at /usr/lib/x86_64-linux-gnu/libruby-3.2.so.3.2.3) rb_proc_call_kw (at /usr/lib/x86_64-linux-gnu/libruby-3.2.so.3.2.3) ``` ruby/openssl@309c55d755
I think we have spare bits here, so let's expand them out and see what happens. This will allow us to have more than 7 size pools in the future
Fix a some bugs in the type lattice around classes and user-defined classes. Refine types more precisely to subclasses of object. With that fix, add const-folding support for IsA. Co-authored-by: John Hawthorn <john.hawthorn@shopify.com> Co-authored-by: Luke Gruber <luke.gruber@shopify.com>
This shouldn't do anything right now under the default GC, but in the future (or now on MMTK?) this would allow them to be allocated from a smaller size pool.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )