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

Implement size hints for FlatSampleIterator #180

Merged
merged 2 commits into from
Jan 5, 2023

Conversation

Shnatsel
Copy link
Contributor

@Shnatsel Shnatsel commented Jan 2, 2023

This lets the caller know how much memory they should allocate.

Doesn't seem to do much to address #172, but may help some users since it's part of the public API.

@Shnatsel
Copy link
Contributor Author

Shnatsel commented Jan 2, 2023

I've also implemented nth() so that the given channel can be looked up directly.

It's a terrible idea to use this iterator if you want to process a specific channel, but this impl makes it slightly less terrible.

(frankly it's a bad idea to use this iterator in the first place. Any processing that can be done on a per-channel basis should be - just get a slice of the channel and process it in chunks; this helps with cache utilization and memory bandwidth, and allows vectorization. This is called "data-oriented programming" for some reason).

@johannesvollmer johannesvollmer merged commit 56f1d0a into johannesvollmer:master Jan 5, 2023
@johannesvollmer
Copy link
Owner

thanks :) great addition

@Shnatsel Shnatsel deleted the iterator-size-hint branch January 5, 2023 12:36
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