this post was submitted on 08 Apr 2024
59 points (91.5% liked)
Rust
7274 readers
3 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
It would be interesting to see if an iterator instead of a manual for loop would increase the performance of the base case.
My guess is not, because the compiler should know they are equivalent, but would be interesting to check anyway.
Do you mean this for loop?
That does use an iterator
Anti Commercial AI thingy
CC BY-NC-SA 4.0I think they meant using for accumulating, like this:
Yes. That's what I meant.
Though I heavily expect the rust compiler to produce identical assembly for both types of iteration.