fix(rrweb): use FNV-1a hash for canvas frame dedup instead of full base64#140
Merged
TueHaulund merged 1 commit intomainfrom Mar 4, 2026
Merged
fix(rrweb): use FNV-1a hash for canvas frame dedup instead of full base64#140TueHaulund merged 1 commit intomainfrom
TueHaulund merged 1 commit intomainfrom
Conversation
pauldambra
approved these changes
Mar 4, 2026
…se64 Replace lastBlobMap (storing ~400KB base64 strings per canvas) with lastFingerprintMap (storing 8-char FNV-1a hex digests). For unchanged frames, skip the expensive encode(arrayBuffer) call entirely. This reduces worker memory per canvas from ~400KB to 8 bytes and eliminates ~400KB of temporary string allocations per unchanged frame, which helps Safari's GC keep up in high-frequency canvas capture scenarios.
f3ed884 to
43080f4
Compare
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lastBlobMap: Map<number, string>(storing full ~400KB base64 strings per canvas) withlastFingerprintMap: Map<number, string>(storing 8-char FNV-1a hex digests)encode(arrayBuffer)call entirely — hash comparison is done on the raw ArrayBuffer bytescrypto.subtle/ secure context requirement)Context: investigating ~0.5MB/s memory growth in Safari with session recording enabled on canvas-heavy apps (PostHog/posthog-flutter#306). The canvas capture pipeline creates ~2-3MB of temporary allocations per frame at 2 FPS, overwhelming Safari's GC in Web Workers.
Test plan