-
Notifications
You must be signed in to change notification settings - Fork 6
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
upstream: perf: Avoid an extra function call and object clone during event emission #180
upstream: perf: Avoid an extra function call and object clone during event emission #180
Conversation
9c68c30
to
3a7f7f9
Compare
Ref rrweb-io#1441 |
…sion (rrweb-io#1441) performance: remove a nested function call and an object clone during event emission - rename `event` to `eventWithoutTime`, but maintain backwards compatibility - `eventWithTime` (with time) could be renamed to `event` in a future version This is an extension of PR rrweb-io#1339 authored by: mydea <mydea@users.noreply.github.com>
3a7f7f9
to
5eef4f8
Compare
function wrapEvent(e: event): eventWithTime { | ||
const eWithTime = e as eventWithTime; | ||
eWithTime.timestamp = nowTimestamp(); | ||
return eWithTime; | ||
} | ||
|
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.
Added in #124, but removed in upstream PR which builds upon #124.
size-limit report 📦
|
type: EventType.IncrementalSnapshot, | ||
data: { | ||
source: IncrementalSource.CanvasMutation, | ||
...p, |
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.
more a sidenote and unrelated to this PR, but I wonder if we could/should also make a change to all of these to avoid spreading these, and instead just set the source on the data 🤔 may help a little bit with memory usage, but not sure if worth it...
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.
We could run benchmark suite and see if there's anything noticable.
performance: remove a nested function call and an object clone during event emission
event
toeventWithoutTime
, but maintain backwards compatibilityeventWithTime
(with time) could be renamed toevent
in a future versionThis is an extension of PR rrweb-io#1339 authored by: mydea mydea@users.noreply.github.com