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

[stdlib] Use named output for _ListIter __next__() method #3941

Closed
wants to merge 1 commit into from

Conversation

bgreni
Copy link
Contributor

@bgreni bgreni commented Jan 12, 2025

  • Add a trivial optimization to use a named output for the __next__() method in _ListIter to save a subtraction operation on every iteration

@bgreni bgreni requested a review from a team as a code owner January 12, 2025 23:06
@bgreni bgreni force-pushed the named-out-list-iter branch 2 times, most recently from f633d35 to 0273855 Compare January 13, 2025 06:46
Signed-off-by: Brian Grenier <grenierb96@gmail.com>
@bgreni bgreni force-pushed the named-out-list-iter branch from 0273855 to 29d992f Compare January 14, 2025 18:36
Copy link
Collaborator

@JoeLoser JoeLoser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a clever use of out parameters here, nice find!

@JoeLoser
Copy link
Collaborator

!sync

@modularbot modularbot added the imported-internally Signals that a given pull request has been imported internally. label Jan 15, 2025
@bgreni
Copy link
Contributor Author

bgreni commented Jan 15, 2025

Thank you! I didn't really get them at first, but I'm becoming quite fond of them!

@modularbot
Copy link
Collaborator

✅🟣 This contribution has been merged 🟣✅

Your pull request has been merged to the internal upstream Mojo sources. It will be reflected here in the Mojo repository on the nightly branch during the next Mojo nightly release, typically within the next 24-48 hours.

We use Copybara to merge external contributions, click here to learn more.

@modularbot modularbot added the merged-internally Indicates that this pull request has been merged internally label Jan 15, 2025
modularbot pushed a commit that referenced this pull request Jan 16, 2025
…(#53928)

[External] [stdlib] Use named output for _ListIter __next__() method

Add a trivial optimization to use a named output for the `__next__()`
method in `_ListIter` to save a subtraction operation on every iteration

Co-authored-by: bgreni <42788181+bgreni@users.noreply.github.com>
Closes #3941
MODULAR_ORIG_COMMIT_REV_ID: 426ada8f07f91a0d14ffe0c6e77ae074405e52c2
@modularbot modularbot added the merged-externally Merged externally in public mojo repo label Jan 16, 2025
@modularbot
Copy link
Collaborator

Landed in add55a5! Thank you for your contribution 🎉

@modularbot modularbot closed this Jan 16, 2025
jjvraw pushed a commit to jjvraw/mojo that referenced this pull request Jan 16, 2025
…(#53928)

[External] [stdlib] Use named output for _ListIter __next__() method

Add a trivial optimization to use a named output for the `__next__()`
method in `_ListIter` to save a subtraction operation on every iteration

Co-authored-by: bgreni <42788181+bgreni@users.noreply.github.com>
Closes modular#3941
MODULAR_ORIG_COMMIT_REV_ID: 426ada8f07f91a0d14ffe0c6e77ae074405e52c2

Signed-off-by: Joshua James Venter <venter.joshua@gmail.com>
modularbot pushed a commit that referenced this pull request Jan 17, 2025
…54072)

[External] [stdlib] Use out param for __next__() in more iterators

Apply the change from #3941 to
other iterators where it applies.

Co-authored-by: bgreni <42788181+bgreni@users.noreply.github.com>
Closes #3952
MODULAR_ORIG_COMMIT_REV_ID: 9d96b4c3da86b8a5f4e990a6029dddc8fc7bc84d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported-internally Signals that a given pull request has been imported internally. merged-externally Merged externally in public mojo repo merged-internally Indicates that this pull request has been merged internally
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants