Commit 1d5f263
committed
perf: Optimize ShareableMap.clear() using TypedArray.fill()
Replaces the manual loop for zeroing out the index buffer with `TypedArray.prototype.fill()`. This significantly improves the performance of the `clear()` method.
Benchmarks showed an improvement from ~7.15ms to ~1.17ms for a map with 500,000 expected size (~6x faster).
Correctly handles `DataView` offsets and lengths to ensure safe memory access.1 parent 5946d67 commit 1d5f263
1 file changed
Lines changed: 1 addition & 3 deletions
File tree
- src/map
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
198 | | - | |
199 | | - | |
| 197 | + | |
200 | 198 | | |
201 | 199 | | |
202 | 200 | | |
| |||
0 commit comments