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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can u explain for me, why do we need to use this library instead of using normal for loop ? i want to know about performance #387

Open
lamhieo02 opened this issue Oct 23, 2023 · 2 comments

Comments

@lamhieo02
Copy link

No description provided.

@ivila
Copy link

ivila commented Oct 25, 2023

Maybe you could check about the topic "Functional programming", it should answer your question about why people need this.

@x1unix
Copy link

x1unix commented Nov 24, 2023

@lamhieo02 it's more convenient to do complex processing in a declarative way using map/filter/reduce/flatmap chains.

Usually, this functionality uses the power of iterators to avoid unnecessary memory allocations, but this library (and JS as well) consumes and returns plain slices which leads to increased memory allocation.

It's possible to implement the same functionality with iterators (example), but as Go (yet) isn't designed with iterators in mind - you'll still need to transform a final result into a slice to use it in code which isn't familiar with iterators.

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

3 participants