Skip to content

Read anti-aliasing pixels from the 32-bit view - #172

Merged
mourner merged 1 commit into
mapbox:mainfrom
g4lb:perf-aa-32bit-reads
Nov 24, 2026
Merged

mourner merged 1 commit into
mapbox:mainfrom
g4lb:perf-aa-32bit-reads

Conversation

@g4lb

@g4lb g4lb commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

antialiased() now reads each pixel from the Uint32Array view as one value, not as 4 bytes. The output does not change.

Input Before After Change
Fixtures 1 to 7 8.32 ms 8.04 ms -3.4%
Soft-edged shapes, 320×240, moved by 1 px 642 µs 600 µs -6.6%
300 images of 2×2 211 µs 192 µs -8.7%

I measured no slowdown (15 rounds, Mann-Whitney test, Apple M2 Max, Node 24). I did not test browsers or big-endian platforms.

Checks:

  • npm test passes on Node 24 and Node 18.
  • Old and new outputs matched on 1M random inputs.

@g4lb
g4lb requested a review from a team as a code owner November 24, 2026 12:12
@g4lb
g4lb requested review from stepankuzmin and removed request for a team November 24, 2026 12:12
@stepankuzmin
stepankuzmin requested a review from mourner November 24, 2026 12:40
@mourner
mourner merged commit 40558aa into mapbox:main Nov 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants