-
Notifications
You must be signed in to change notification settings - Fork 979
perf(core): rework attribute serialisation #5866
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
Conversation
Does a couple of things: - Switches to a regular `for...in` which is much faster than `Object.entries` - Only retrieves the `val` if the key is valid - Compares keys against `""` (empty string) rather than accessing `length` - Reuses `typeof` result rather than recomputing it each time
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5866 +/- ##
==========================================
- Coverage 95.00% 94.99% -0.01%
==========================================
Files 313 313
Lines 8771 8775 +4
Branches 1883 1884 +1
==========================================
+ Hits 8333 8336 +3
- Misses 438 439 +1
🚀 New features to boost your workflow:
|
|
Could you provide some comparative figures given this is for perf ? |
|
here's the results from a quick benchmark locally: to be honest though, a large amount of the time is lost to i wonder if you could optimise the log proxy to compute the logger up front? basically this: const logger = getGlobal('diag');
if (!logger) return noop;
const logFn = logger[funcName];
return logFn;but it'd mean if you mutate |
legendecas
left a comment
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.
Thanks for the work! LGTM % a nit.
Co-authored-by: Chengzhong Wu <[email protected]>
|
@43081j thanks for your contribution. I think this change needs an entry into |
|
i've added an entry under "internal" if that works |
|
we had a conflict from another merged PR, so I've caught the branch up again FYI |
Does a couple of things:
for...inwhich is much faster thanObject.entriesvalif the key is valid""(empty string) rather than accessinglengthtypeofresult rather than recomputing it each timeType of change
Performance improvement
How Has This Been Tested?
Existing unit tests cover this code, and pass successfully.
Checklist: