Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only add the trailing nop if the catch table is not break / next / redo #4055

Merged
merged 1 commit into from
Jan 13, 2021

Conversation

tenderlove
Copy link
Member

We don't need nop padding when the catch tables are only for break /
next / redo, so lets avoid them. This eliminates nop padding in
many lambdas.

I think this is a better alternative to #4040.

Here are the instructions used for RailsBench on master:

insn-count-master

Text version:

10               setinstancevariable  4332095
97                     getlocal_WC_1  5175882
17                            putnil  6911093
83                          opt_aref  8455003
19                         putobject  9321480
35                               pop  9635247
98                     setlocal_WC_0 11036016
62                          branchif 11088913
9                getinstancevariable 12011517
36                               dup 12020746
65                opt_getinlinecache 13121324
63                      branchunless 13441822
1                                nop 15066779
18                           putself 24045912
59                             leave 34046308
51            opt_send_without_block 45677897
96                     getlocal_WC_0 58353340

Here are the instructions used on this branch:

insn-count-branch

97                     getlocal_WC_1  5175882
1                                nop  6869821
17                            putnil  6911093
83                          opt_aref  8455003
19                         putobject  9321480
35                               pop  9635251
98                     setlocal_WC_0 11036016
62                          branchif 11087301
9                getinstancevariable 12009905
36                               dup 12019146
65                opt_getinlinecache 13121328
63                      branchunless 13441838
18                           putself 24045118
59                             leave 34043898
51            opt_send_without_block 45675507
96                     getlocal_WC_0 58352550

This patch eliminates about 8mil nop calls.

Here is the req / s graph:

speed

It seems like there is some improvement, though it's not huge.

/cc @XrXr @jhawthorn

We don't need nop padding when the catch tables are only for break /
next / redo, so lets avoid them.  This eliminates nop padding in
many lambdas.

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
@tenderlove tenderlove merged commit c8b47eb into ruby:master Jan 13, 2021
@tenderlove tenderlove deleted the nonop branch January 13, 2021 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant