-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[mypyc] Initial optimization for f-string through a str.join() specializer #10776
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great performance improvement! Left some comments. Maybe also incorporate the int-to-str improvements from the other PR?
return builder.load_str("") | ||
|
||
result_list[0] = Integer(len(result_list) - 1, c_pyssize_t_rprimitive) | ||
return builder.call_c(str_build_op, result_list, expr.line) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point it should be possible to share some of the code above with the str.format
implementation. No need to do anything about this in this PR.
Description
This pull request adds a specializer for faster constructing f-string, which is translated into str.join() previously in mypy AST.
Test Plan
IR building tests:
Speed up:
on this case:
Current master branch is 0.380x.