-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Allow AsyncSequence operators to be inlined in their construction #38310
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
Conversation
I can add benchmarks for this but it seems that #36908 has not yet been merged. |
@swift-ci please smoke test |
This is the PR you'll need for benchmarking: #36923 |
0107671
to
bf090b9
Compare
@swift-ci please smoke test |
LGTM the numbers we spoke about earlier today sound really impressive |
Can someone ELI5 how a computer running at a few gigahertz (billions of operations per second) could do anything more than a trillion times per second? |
the claim actually has to do more with the inline of the code rather than actual operations per second, what is happening is that the compiler can see through the implementation enough that the execution is now just a memcpy and the actual work is zero here. So perhaps the number of trillions is slightly in bad faith - but more so a testament to the amazing optimization this now can enjoy. |
long/short, any per-item benchmark div-0's ;) |
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.
looks good to me
This grants AsyncSequence a huge perf boost for trivial operator application. Locally this benchmarks initially at about 3 million events per second to afterwards over 30 trillion events per second (this is an artificial speed - it is just reflecting the fact that the pipeline now takes zero time since it is already computed due to inlines)!
Previously the compiler could not see past the initialization and so any application of operators were blocked by the initialization of the operator. Now the initialization is visible and consequently the application can be directly inlined into any code-gen for usage.