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

feat: add clonevt methods #87

Merged
merged 4 commits into from
Jun 27, 2023
Merged

feat: add clonevt methods #87

merged 4 commits into from
Jun 27, 2023

Conversation

kruskall
Copy link
Member

Benchmark showed a 50% decrease in cpu time when comparing the two
clone methods:

               │  before.txt  │              after.txt              │
               │    sec/op    │   sec/op     vs base                │
Clone/clone-20   15.099µ ± 6%   7.326µ ± 5%  -51.48% (p=0.000 n=10)

               │  before.txt  │              after.txt              │
               │     B/op     │     B/op      vs base               │
Clone/clone-20   12.77Ki ± 0%   12.20Ki ± 0%  -4.46% (p=0.000 n=10)

               │ before.txt │             after.txt             │
               │ allocs/op  │ allocs/op   vs base               │
Clone/clone-20   172.0 ± 0%   163.0 ± 0%  -5.23% (p=0.000 n=10)

Additionally, since clone already performs a deep copy, we can avoid
cloning the event twice.

Benchmark showed a 50% decrease in cpu time when comparing the two
clone methods:

               │  before.txt  │              after.txt              │
               │    sec/op    │   sec/op     vs base                │
Clone/clone-20   15.099µ ± 6%   7.326µ ± 5%  -51.48% (p=0.000 n=10)

               │  before.txt  │              after.txt              │
               │     B/op     │     B/op      vs base               │
Clone/clone-20   12.77Ki ± 0%   12.20Ki ± 0%  -4.46% (p=0.000 n=10)

               │ before.txt │             after.txt             │
               │ allocs/op  │ allocs/op   vs base               │
Clone/clone-20   172.0 ± 0%   163.0 ± 0%  -5.23% (p=0.000 n=10)

Additionally, since clone already performs a deep copy, we can avoid
cloning the event twice.
@kruskall kruskall requested a review from a team June 27, 2023 02:58
Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

nice!

@kruskall kruskall merged commit 5d40e56 into elastic:main Jun 27, 2023
2 checks passed
@kruskall kruskall deleted the feat/clone-vt branch June 27, 2023 11:44
endorama pushed a commit to endorama/apm-data that referenced this pull request Jun 28, 2023
* feat: add clonevt feature to modelpb generation

* feat: generate clonevt methods

* feat: use clonevt methods in decoders

Benchmark showed a 50% decrease in cpu time when comparing the two
clone methods:

               │  before.txt  │              after.txt              │
               │    sec/op    │   sec/op     vs base                │
Clone/clone-20   15.099µ ± 6%   7.326µ ± 5%  -51.48% (p=0.000 n=10)

               │  before.txt  │              after.txt              │
               │     B/op     │     B/op      vs base               │
Clone/clone-20   12.77Ki ± 0%   12.20Ki ± 0%  -4.46% (p=0.000 n=10)

               │ before.txt │             after.txt             │
               │ allocs/op  │ allocs/op   vs base               │
Clone/clone-20   172.0 ± 0%   163.0 ± 0%  -5.23% (p=0.000 n=10)

Additionally, since clone already performs a deep copy, we can avoid
cloning the event twice.
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.

3 participants