Commit 36cd199
authored
feat: CPU utilization optimization in image diff calculations (#414)
- 4x improvement in image comparison
- Use low-level coding techniques to calculate tile signatures faster
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes the hashing/equality behavior and low-level pixel hashing loop
used in image comparisons, so regressions could affect diff accuracy or
performance across edge cases (odd tile widths, mutable signature
lists).
>
> **Overview**
> Speeds up bitmap tile signature generation used for image diffing by
reducing per-pixel work and avoiding repeated hashing.
>
> `ImageSignature` now caches its `hashCode()` (with a quick reject in
`equals`) and `TileSignatureManager.computeInternal` precomputes an
accumulated tile hash while generating signatures. Tile hashing is
rewritten to pack two ARGB pixels into a single `Long` and hash per-pair
(plus an optional trailing pixel) instead of hashing each pixel
byte-by-byte.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
75ade55. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent d1eb13d commit 36cd199
File tree
1 file changed
+81
-35
lines changed- sdk/@launchdarkly/observability-android/lib/src/main/kotlin/com/launchdarkly/observability/replay/capture
1 file changed
+81
-35
lines changedLines changed: 81 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
19 | 70 | | |
20 | 71 | | |
21 | 72 | | |
| |||
83 | 134 | | |
84 | 135 | | |
85 | 136 | | |
86 | | - | |
87 | | - | |
| 137 | + | |
88 | 138 | | |
| 139 | + | |
89 | 140 | | |
90 | 141 | | |
91 | 142 | | |
92 | | - | |
93 | 143 | | |
94 | 144 | | |
95 | 145 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
106 | 149 | | |
107 | 150 | | |
108 | 151 | | |
109 | | - | |
| 152 | + | |
110 | 153 | | |
111 | 154 | | |
112 | 155 | | |
113 | 156 | | |
114 | 157 | | |
| 158 | + | |
115 | 159 | | |
116 | 160 | | |
117 | 161 | | |
118 | | - | |
| 162 | + | |
119 | 163 | | |
120 | 164 | | |
121 | 165 | | |
122 | 166 | | |
123 | 167 | | |
124 | 168 | | |
125 | 169 | | |
126 | | - | |
127 | 170 | | |
128 | 171 | | |
129 | | - | |
130 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
131 | 179 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
148 | 194 | | |
149 | 195 | | |
150 | 196 | | |
| |||
0 commit comments