-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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 by Bors] - Optimize Events::extend and impl std::iter::Extend #2207
Conversation
Wouldn't that make the (more common) case of sending only one event worse? |
It shouldn't no. Arguably, if there is a regression for the single |
955c48e
to
f2a9b23
Compare
b30cdd0
to
8b590bc
Compare
@mockersf |
yay for implementing std traits! |
dae4259
to
95c1836
Compare
Looks good to me! I agree that separate extend and send impls makes sense here. The code is simple enough that I'd rather just inline it. |
bors r+ |
The previous implementation of `Events::extend` iterated through each event and manually `sent` it via `Events:;send`. However, this could be a minor performance hit since calling `Vec::push` in a loop is not optimal. This refactors the code to use `Vec::extend`.
Pull request successfully merged into main. Build succeeded: |
The previous implementation of `Events::extend` iterated through each event and manually `sent` it via `Events:;send`. However, this could be a minor performance hit since calling `Vec::push` in a loop is not optimal. This refactors the code to use `Vec::extend`.
The previous implementation of
Events::extend
iterated through each event and manuallysent
it viaEvents:;send
.However, this could be a minor performance hit since calling
Vec::push
in a loop is not optimal.This refactors the code to use
Vec::extend
.