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

Generate Batch without intermediate steps #10

Closed
chaudum opened this issue Dec 1, 2021 · 0 comments · Fixed by #12
Closed

Generate Batch without intermediate steps #10

chaudum opened this issue Dec 1, 2021 · 0 comments · Fixed by #12

Comments

@chaudum
Copy link
Collaborator

chaudum commented Dec 1, 2021

ATM, we generate a large slice of Entry and then convert them into a Batch.
To optimize allocations and CPU usage, generating the step could be done directly.

chaudum added a commit that referenced this issue Dec 1, 2021
This implementation is highly inefficient! It should be replaced when
the intermediate step of creating entries (`[]Entry`) is removed (see
issue #10).

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
chaudum added a commit that referenced this issue Dec 1, 2021
This implementation is highly inefficient! It should be replaced when
the intermediate step of creating entries (`[]Entry`) is removed (see
issue #10).

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
chaudum added a commit that referenced this issue Dec 1, 2021
This implementation is highly inefficient! It should be replaced when
the intermediate step of creating entries (`[]Entry`) is removed (see
issue #10).

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
mstoykov added a commit that referenced this issue Dec 3, 2021
Fixes #10

Basic benchmark results:
old are the results with making entries and then batch,
old- is only making the entries
new is the new variant where we directly make the batch

as can be seen there is around 50% reduction

name \ time/op     old.bench    old-.bench   new.bench
GenerateEntries-8   255µs ± 9%   202µs ± 4%  138µs ± 5%

name \ alloc/op    old.bench    old-.bench   new.bench
GenerateEntries-8  20.2kB ± 0%  12.5kB ± 0%  9.3kB ± 0%

name \ allocs/op   old.bench    old-.bench   new.bench
GenerateEntries-8     435 ± 0%     213 ± 0%    216 ± 0%

Co-authored-by: Christian Haudum <christian.haudum@gmail.com>
chaudum added a commit that referenced this issue Dec 3, 2021
Fixes #10

Basic benchmark results:
old are the results with making entries and then batch,
old- is only making the entries
new is the new variant where we directly make the batch

as can be seen there is around 50% reduction

name \ time/op     old.bench    old-.bench   new.bench
GenerateEntries-8   255µs ± 9%   202µs ± 4%  138µs ± 5%

name \ alloc/op    old.bench    old-.bench   new.bench
GenerateEntries-8  20.2kB ± 0%  12.5kB ± 0%  9.3kB ± 0%

name \ allocs/op   old.bench    old-.bench   new.bench
GenerateEntries-8     435 ± 0%     213 ± 0%    216 ± 0%

Co-authored-by: Christian Haudum <christian.haudum@gmail.com>
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 a pull request may close this issue.

1 participant