Skip to content

Use into_iter() instead of iter().cloned().#749

Merged
ueco-jb merged 1 commit intoCosmWasm:mainfrom
0xekez:zeke/into-iter
Jul 8, 2022
Merged

Use into_iter() instead of iter().cloned().#749
ueco-jb merged 1 commit intoCosmWasm:mainfrom
0xekez:zeke/into-iter

Conversation

@0xekez
Copy link
Copy Markdown
Contributor

@0xekez 0xekez commented Jul 6, 2022

This ought to be a little more efficient as we don't need to clone every element as we walk the list.

Just for fun, I wrote a little benchmark for this, then ran it with a couple different sizes using hyperfine. The into_iter() method was around 1.5x as fast.

Copy link
Copy Markdown
Contributor

@ueco-jb ueco-jb left a comment

Choose a reason for hiding this comment

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

LGTM
Thank you for that, very good spot :)

@ueco-jb ueco-jb merged commit b816d7d into CosmWasm:main Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants