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

merge rrweb #903 performance improvements #75

Merged
merged 24 commits into from
Jun 13, 2022
Merged

Commits on Jun 2, 2022

  1. Remove INode (node.__sn) and use Mirror as source of truth (#868)

    * Move ids to weakmap
    
    * Fix typo
    
    * Move from INode to storing serialized data in mirror
    
    * Update packages/rrweb-snapshot/src/rebuild.ts
    
    Co-authored-by: Yun Feng <[email protected]>
    
    * Remove unnessisary `as Node` typecastings
    
    Fixes: rrweb-io/rrweb#868 (comment)
    
    * Remove unnessisary `as unknown as ...`
    
    * Remove unnessisary `as unknown as ...`
    
    * Reset mirror when recording starts
    
    Solves: rrweb-io/rrweb#868 (comment)
    
    * API has changed for snapshot, change test to reflect that
    
    * Allow for es5 compatibility
    
    * Remove unnessisary as unknown as ... and change test to reflect the API change
    
    * Refactor mirror to remove `nodeIdMap`
    
    Fixes: rrweb-io/rrweb#868 (comment)
    
    Co-authored-by: Yun Feng <[email protected]>
    2 people authored and Vadman97 committed Jun 2, 2022
    Configuration menu
    Copy the full SHA
    8069055 View commit details
    Browse the repository at this point in the history
  2. Fix mutation edge case when blocked class gets unblocked (#867)

    * Fix mutation edge case when blocked class gets unblocked
    
    * Add integration test
    
    * Update isSerialized logic
    rahulrelicx authored and Vadman97 committed Jun 2, 2022
    Configuration menu
    Copy the full SHA
    627d54f View commit details
    Browse the repository at this point in the history
  3. Record canvas snapshots N times per second (#859)

    * Only record canvas when recordCanvas is true
    
    * All should be compiled first
    
    Makes recompiling+debugging a lot faster
    
    * Add support for compiling web workes
    
    Replaces @rollup/plugin-typescript for rollup-plugin-typescript2 as the former is incompatible with rollup-plugin-web-worker-loader
    
    * Update yarn.lock
    
    * Upgrade to typescript 4.5.5
    
    * add support for replay of ImageBitmap in 2d canvas
    
    * Snapshot canvases in a web-worker on FPS basis
    
    * Fix performance of canvas recording and playback
    
    * Wait for all images to be preloaded before checking results
    
    * flatten base64 strings, as encoding isn't consistent
    
    * Cleanup
    
    * Add serializing to 2d canvases as well
    
    * Disable blob serialize test
    
    We don't have any code for it yet
    
    * Upgrade @rollup/plugin-commonjs to 21.0.2
    
    Fixes
    https://linguinecode.com/post/import-export-appear-at-the-top-level
    
    * Move canvas recording options to `sampling`
    
    Based on: rrweb-io/rrweb#859 (comment)
    Juice10 authored and Vadman97 committed Jun 2, 2022
    Configuration menu
    Copy the full SHA
    1c851c9 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    94e0007 View commit details
    Browse the repository at this point in the history
  5. Fix for issue #890 (#891)

    dkozlovskyi authored and Vadman97 committed Jun 2, 2022
    Configuration menu
    Copy the full SHA
    b49f505 View commit details
    Browse the repository at this point in the history
  6. Perf: Apply the latest text mutation only (#885)

    * Perf: apply the latest text mutation only
    
    * Find unique text mutations in one iteration
    Juice10 authored and Vadman97 committed Jun 2, 2022
    Configuration menu
    Copy the full SHA
    c3de806 View commit details
    Browse the repository at this point in the history
  7. * rrdom: add a diff function for properties

    * implement diffChildren function and unit tests
    
    * finish basic functions of diff algorithm
    
    * fix several bugs in the diff algorithm
    
    * replace the virtual parent optimization in applyMutation()
    
    * fix: moveAndHover after the diff algorithm is executed
    
    * replace virtual style map with rrdom
    
    cssom version has to be above 0.5.0 to pass virtual style tests
    
    * fix: failed virtual style tests in replayer.test.ts
    
    * fix: failed polyfill tests caused by nodejs compatibility of different versions
    
    * fix: svg viewBox attribute doesn't work
    
    Cause the attribute viewBox is case sensitive, set value for viewbox doesn't work
    
    * feat: replace treeIndex optimization with rrdom
    
    * fix bug of diffProps and disable smooth scrolling animation in fast-forward mode
    
    * feat: add iframe support
    
    * fix: @rollup/plugin-typescript build errors in rrweb-player
    
    Error: @rollup/plugin-typescript TS1371: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'
    
    * fix: bug when fast-forward input events and add test for it
    
    * add test for fast-forward scroll events
    
    * fix: custom style rules don't get inserted into some iframe elements
    
    * code style tweak
    
    * fix: enable to diff iframe elements
    
    * fix  the jest error "Unexpected token 'export'"
    
    * try to fix build error of rrweb-player
    
    * correct the attributes definition in rrdom
    
    * fix: custom style rules are not inserted in some iframes
    
    * add support for shadow dom
    
    * add support for MediaInteraction
    
    * add canvas support
    
    * fix unit test error in rrdom
    
    * add support for Text, Comment
    
    * try to refactor RRDom
    
    * refactor RRDom to reduce duplicate code
    
    * rename document-browser to virtual-dom
    
    * increase the test coverage for document.ts and add ownerDocument for it
    
    * Merge branch 'master' into virtual-dom
    
    * add more test for virtual-dom.ts
    
    * use cssstyle in document-nodejs
    
    * fix: bundle error
    
    * improve document-nodejs
    
    * enable to diff scroll positions of an element
    
    * rename rrdom to virtualDom for more readability and make the tree public
    
    * revert unknown change
    
    * improve the css style parser for comments
    
    * improve code style
    
    * update typings
    
    * add handling for the case where legacy_missingNodeRetryMap is not empty
    
    * only import types from rrweb into rrdom
    
    * Apply suggestions from code review
    
    Co-authored-by: Justin Halsall <[email protected]>
    
    * Apply suggestions from code review
    
    * fix building error in rrweb
    
    * add a method setDefaultSN to set a default value for a RRNode's __sn
    
    * fix rrweb test error and bump up other packages
    
    * add support for custom property of css styles
    
    * add a switch for virtual-dom optimization
    
    * Apply suggestions from code review
    
    1. add an enum type for NodeType
    2. rename nodeType from rrweb-snapshot to RRNodeType
    3. rename notSerializedId to unserializedId
    4. add comments for some confusing variables
    
    * adapt changes of #865 to virtual-dom and improve the test case for more coverage
    
    * apply review suggestions
    
    rrweb-io/rrweb#853 (review)
    
    * tweak the diff algorithm
    
    * add description of the flag useVirtualDom and remove outdated logConfig
    
    * Remove console.log
    
    * Contain changes to document
    
    * Upgrade rollup to 2.70.2
    
    * Revert "Upgrade rollup to 2.70.2"
    
    This reverts commit b1be81a2a76565935c9dc391f31beb7f64d25956.
    
    * Fix type checking rrdom
    
    * Fix typing error while bundling
    
    * Fix tslib error on build
    
    Rollup would output the following error:
    `semantic error TS2343: This syntax requires an imported helper named '__spreadArray' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.`
    
    * Increase memory limit for rollup
    
    * Use esbuild for bundling
    
    Speeds up bundling significantly
    
    * Avoid circular dependencies and import un-bundled rrdom
    
    * Fix imports
    
    * Revert back to pre-esbuild
    
    This reverts the following commits:
    b7b3c8dbaa551a0129da1477136b1baaad28e6e1
    72e23b8e27f9030d911358d3a17fe5ad1b3b5d4f
    85d600a20c56cfa764cf1f858932ba14e67b1d23
    61e1a5d323212ca8fbe0569e0b3062ddd53fc612
    
    * Set node to lts (12 is no longer supported)
    
    * Speed up bundling and use less memory
    
    This fixes the out of memory errors happening while bundling
    
    * remove __sn from rrdom
    
    * fix typo
    
    * test: add a test case for StyleSheet mutation exceptions while fast-forwarding
    
    * rename Array.prototype.slice.call() to Array.from()
    
    * improve test cases
    
    * fix: PR #887 in 'virtual-dom' branch
    
    * apply justin's suggestion on 'Array.from' refactor
    
    related commit 0f6729d27a323260b36fbe79485a86715c0bc98a
    
    * improve import code structure
    
    Co-authored-by: Yun Feng <[email protected]>
    2 people authored and Vadman97 committed Jun 2, 2022
    Configuration menu
    Copy the full SHA
    0e91e84 View commit details
    Browse the repository at this point in the history
  8. Introduce benchmark tests and improve snapshot attributes traversing …

    …(#897)
    
    * housekeeping: refine test utils
    
    * setup benchmark tests
    
    * improve snapshot attributes loop perf
    Yuyz0112 authored and Vadman97 committed Jun 2, 2022
    Configuration menu
    Copy the full SHA
    4711692 View commit details
    Browse the repository at this point in the history
  9. Chore: Add issue/pr template and general housekeeping tools and docs …

    …(#900)
    
    * Add linting
    
    * Add issue templates and docs
    
    * Add root eslint config and remove tslint
    
    * Autofix lint issues
    Juice10 authored and Vadman97 committed Jun 2, 2022
    Configuration menu
    Copy the full SHA
    dc64d49 View commit details
    Browse the repository at this point in the history
  10. Fix #904 (#906)

    Properly remove crossorigin attribute
    Juice10 authored and Vadman97 committed Jun 2, 2022
    Configuration menu
    Copy the full SHA
    1d7fcbd View commit details
    Browse the repository at this point in the history
  11. inline stylesheets when loaded

    Juice10 authored and Vadman97 committed Jun 2, 2022
    Configuration menu
    Copy the full SHA
    11cd5ca View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    3514b4f View commit details
    Browse the repository at this point in the history
  13. Clean up stylesheet manager

    Juice10 authored and Vadman97 committed Jun 2, 2022
    Configuration menu
    Copy the full SHA
    1dcd7ea View commit details
    Browse the repository at this point in the history
  14. Remove attribute mutation code

    Juice10 authored and Vadman97 committed Jun 2, 2022
    Configuration menu
    Copy the full SHA
    a345326 View commit details
    Browse the repository at this point in the history

Commits on Jun 7, 2022

  1. Bump minimist from 1.2.5 to 1.2.6 (#902)

    Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
    - [Release notes](https://github.com/substack/minimist/releases)
    - [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)
    
    ---
    updated-dependencies:
    - dependency-name: minimist
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored and Vadman97 committed Jun 7, 2022
    Configuration menu
    Copy the full SHA
    e7e78fb View commit details
    Browse the repository at this point in the history

Commits on Jun 10, 2022

  1. Speed up snapshotting of many new dom nodes (#903)

    * Speed up snapshotting of many new dom nodes
    
    By avoiding reflow we shave about 15-25% off our snapshotting time
    
    * Improve newlyAddedElement docs
    
    * Optimize needMaskingText by using el.closest and less recursion
    
    * Serve all rrweb dist files
    
    * Split serializeNode into smaller functions
    
    Makes it easier to profile
    
    * Slow down cpu enhance tracing on fast machines
    
    * Increase timeout
    
    * Perf: only loop through ancestors when they have something to compare to
    
    * Perf: `hasNode` is cheaper than `getMeta`
    
    * Perf: If parents where already checked, no need to do it again
    
    * Perf: reverse for loops are faster
    
    Because they only do the .lenght check once. In this case I don't think we'll see much performance gains if any
    
    * Clean up code
    
    * Perf: check ancestors once with isBlocked
    
    * guessing this might fixes canvas test
    
    * Update packages/rrweb/src/record/observers/canvas/webgl.ts
    
    Co-authored-by: yz-yu <[email protected]>
    
    * Fix #904 (#906)
    
    Properly remove crossorigin attribute
    
    * Bump minimist from 1.2.5 to 1.2.6 (#902)
    
    Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
    - [Release notes](https://github.com/substack/minimist/releases)
    - [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)
    
    ---
    updated-dependencies:
    - dependency-name: minimist
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    
    Co-authored-by: yz-yu <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    3 people authored and Vadman97 committed Jun 10, 2022
    Configuration menu
    Copy the full SHA
    e0215fe View commit details
    Browse the repository at this point in the history
  2. highlight fixes after merge

    Vadman97 committed Jun 10, 2022
    Configuration menu
    Copy the full SHA
    1e784f6 View commit details
    Browse the repository at this point in the history
  3. cleanup script

    Vadman97 committed Jun 10, 2022
    Configuration menu
    Copy the full SHA
    2637be9 View commit details
    Browse the repository at this point in the history
  4. bump versions

    Vadman97 committed Jun 10, 2022
    Configuration menu
    Copy the full SHA
    2cc2b5f View commit details
    Browse the repository at this point in the history
  5. update version dependencies

    Vadman97 committed Jun 10, 2022
    Configuration menu
    Copy the full SHA
    3df6929 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    789073d View commit details
    Browse the repository at this point in the history
  7. inline stylesheets when loaded

    set empty link elements to loaded by default
    
    Clean up stylesheet manager
    
    Remove attribute mutation code
    
    Update packages/rrweb/test/record.test.ts
    
    Update packages/rrweb/test/record.test.ts
    
    Update packages/rrweb/test/record.test.ts
    
    Move require out of time sensitive assert
    
    Update packages/rrweb/scripts/repl.js
    
    Update packages/rrweb/test/record.test.ts
    
    Update packages/rrweb/src/record/index.ts
    
    Add todo
    
    Add waitForRAF, its more reliable than waitForTimeout
    
    Remove flaky tests
    
    Add recording stylesheets in iframes
    
    Remove variability from flaky test
    
    Make test more robust
    Juice10 authored and Vadman97 committed Jun 10, 2022
    Configuration menu
    Copy the full SHA
    5d0842f View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    8d38f64 View commit details
    Browse the repository at this point in the history

Commits on Jun 13, 2022

  1. Configuration menu
    Copy the full SHA
    9c64602 View commit details
    Browse the repository at this point in the history