feat: CPU utilization optimization in image diff calculations#146
feat: CPU utilization optimization in image diff calculations#146abelonogov-ld merged 48 commits intomainfrom
Conversation
(cherry picked from commit 78ad485)
…anvas buffer limit. Updated makeExportFrame to accept keyFrameId and isKeyframe parameters. Adjusted canvasBufferLimit to account for keyframe logic. Added test to verify mutation appending when canvas buffer limit is exceeded for non-keyframes.
- Added support for command-line options including scheme, destination, only-testing, skip-testing, and test-file. - Introduced a usage function to display help information. - Implemented a function to derive test identifiers from file paths. - Refactored the test execution command to accommodate new options and improve readability. (cherry picked from commit cd1e1e2)
(cherry picked from commit 54853ad)
… allowing multiple runs. Updated BenchmarkExecutor to return execution time alongside bytes, and modified BenchmarkView to display execution time in results.
- Updated the ExportFrame structure to replace TileSignature with ImageSignature in AddImage and RemoveImage. - Adjusted RRWebEventGenerator and related methods to accommodate the new image signature handling. - Modified unit tests to ensure compatibility with the updated ExportFrame parameters.
(cherry picked from commit 37b2dfd1eb49b3e6f0e64441523119dc2a9111fb)
(cherry picked from commit 8ea1c7b)
…ash-swiftpackage * andrey/exportdiffmanager: separated time Alert errors do account disk reading into benchmark # Conflicts: # Sources/LaunchDarklySessionReplay/BenchMark/BenchmarkExecutor.swift
* main: chore(main): release 0.22.0 (#145) feat: Moves compression before buffer (Optimization) (#144) chore(main): release 0.21.0 (#143) feat: Bridging hooks calls from MAUI (#142) # Conflicts: # Sources/LaunchDarklySessionReplay/BenchMark/BenchmarkExecutor.swift # Sources/LaunchDarklySessionReplay/ScreenCapture/TileSignatureManager.swift # TestApp/Sources/BenchmarkView.swift
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| result.hashHi = (int64_t)h1; | ||
| return result; | ||
| } | ||
| #endif |
There was a problem hiding this comment.
NEON function guard mismatch causes debug build linker error
High Severity
The tile_hash_w64_neon function is declared in the header under #if defined(__ARM_NEON) but its implementation is guarded by #if USE_NEON, which requires both __ARM_NEON and __OPTIMIZE__. In debug builds on ARM (devices and Apple Silicon simulators), __OPTIMIZE__ is not defined, so the declaration is visible but the symbol is never compiled. The parity tests in TileHashParityTests.swift call tile_hash_w64_neon unconditionally, resulting in a linker error in any non-optimized ARM build.
Additional Locations (1)
🤖 I have created a release *beep* *boop* --- ## [0.23.0](0.22.0...0.23.0) (2026-03-06) ### Features * CPU utilization optimization in image diff calculations ([#146](#146)) ([80e0cf8](80e0cf8)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: this PR only updates version numbers and release notes (no runtime code changes beyond `sdkVersion` constant). > > **Overview** > Releases version `0.23.0` by updating the release manifest, CocoaPods podspec versions, and the exported `sdkVersion` constant. > > Updates `CHANGELOG.md` with the `0.23.0` entry noting a CPU utilization optimization in image diff calculations. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit db4a44b. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->


Note
High Risk
Replaces a core image-diff primitive with new low-level C/NEON code and unsafe buffer plumbing, which could affect correctness or stability of session replay capture if edge cases slip through.
Overview
Major perf change: Tile signature generation used for image diffs is rewritten to use a new
SessionReplayCtarget (C + optional ARM NEON), replacing the prior Swift/CommonCrypto SHA-256 per-tile hashing with a faster non-crypto 128-bit style hash and centralized tile layout computation.TileSignatureManagernow callstile_compute_layout/tile_compute_alland reuses an internal C buffer;ImageSignatureis split into its own file and now precomputes an accumulated hash to speed dictionary lookups/equality.Validation/benchmarking: Adds
TileHashParityTeststo ensure NEON and scalar paths match, updates the benchmark tooling/UI to measure signature computation, and forces decoded frame images inRawFrameReaderfor more consistent pixel access. Packaging is updated so CocoaPods and SPM both build/link the newSessionReplayCmodule.Written by Cursor Bugbot for commit d3604f4. This will update automatically on new commits. Configure here.