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

pick: Implement Fisher-Yates left to right instead of right to left #30

Open
webmaster128 opened this issue Dec 29, 2022 · 0 comments
Open

Comments

@webmaster128
Copy link
Contributor

When implementing the algorithm the other way around, the result is in the left positions of the input vector. This allows us to return the result by truncating such which saves a new allocation for the result.

This is how lodash implement's it as well: https://github.com/lodash/lodash/blob/4.17.21/lodash.js#L6767-L6790

However, it's unclear if it is worth the change and should be benchmarked in Wasm. Especially since pick would typically have not too many result items.

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

No branches or pull requests

1 participant