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
Benchmark AssignMutator.Mutate code #1437
Conversation
Current benchmarks on my machine:
|
Codecov Report
@@ Coverage Diff @@
## master #1437 +/- ##
==========================================
+ Coverage 50.41% 50.46% +0.05%
==========================================
Files 77 77
Lines 5108 5108
==========================================
+ Hits 2575 2578 +3
+ Misses 2182 2180 -2
+ Partials 351 350 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We should deepcopy for safety, though if possible, we should deepcopy once per mutation session.
Add benchmark tests for AssignMutator.Mutate. In writing this, I found that mutating objects takes about 10x longer than not mutating objects. Profiling reveals that we spend over 90% of compute time in AssingMutator.Value(), where we convert from the raw JSON value to a literal Go struct. In a separate PR I'll suggest a change that resolves this performance issue. Most likely we'll want to cache the assigned value. We can then either reflect.DeepCopy the value or assign the cached value directly, depending on whether we feel it safe. Signed-off-by: Will Beason <willbeason@google.com>
Add benchmark tests for AssignMutator.Mutate. In writing this, I found that mutating objects takes about 10x longer than not mutating objects. Profiling reveals that we spend over 90% of compute time in AssingMutator.Value(), where we convert from the raw JSON value to a literal Go struct. In a separate PR I'll suggest a change that resolves this performance issue. Most likely we'll want to cache the assigned value. We can then either reflect.DeepCopy the value or assign the cached value directly, depending on whether we feel it safe. Signed-off-by: Will Beason <willbeason@google.com> Signed-off-by: juliankatz <juliankatz@google.com>
Add benchmark tests for AssignMutator.Mutate.
In writing this, I found that mutating objects takes about 10x longer
than not mutating objects. Profiling reveals that we spend over 90% of
compute time in AssingMutator.Value(), where we convert from the raw
JSON value to a literal Go struct.
In a separate PR I'll suggest a change that resolves this performance
issue. Most likely we'll want to cache the assigned value. We can then
either reflect.DeepCopy the value or assign the cached value directly,
depending on whether we feel it safe.
Signed-off-by: Will Beason willbeason@google.com