Skip to content

[mypyc] Mark magic-overlapping error handler branches as rare #13525

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

Merged
merged 1 commit into from
Aug 26, 2022

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Aug 26, 2022

This might slightly improve performance when using native ints,
and it's consistent with how other error handler branches are
treated as rare.

Now the generated error handling code when calling a function
that returns a native int looks something like this (the
unlikely(...) part is new):

    cpy_r_r0 = CPyDef_f();
    cpy_r_r1 = cpy_r_r0 == -113;
    if (unlikely(cpy_r_r1)) goto CPyL2;

This might slightly improve performance when using native ints,
and it's consistent with how other error handler branches are
treated as rare.

Now the generated error handling code when calling a function
that returns a native int looks something like this (the
`unlikely(...)` part is new):

```
    cpy_r_r0 = CPyDef_f();
    cpy_r_r1 = cpy_r_r0 == -113;
    if (unlikely(cpy_r_r1)) goto CPyL2;
```
@JukkaL JukkaL merged commit 74e1737 into master Aug 26, 2022
@JukkaL JukkaL deleted the mypyc-rare-handlers branch August 26, 2022 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant