Skip to content

Conversation

@AdamWRichardson
Copy link
Contributor

@AdamWRichardson AdamWRichardson commented Oct 24, 2025

Using compiler explorer I saw that the compiler wasn't clever enough to optimise away the branches in the masking code. I thought the compiler would have a better chance if we always branched, which turned out to be the case.

Running the benchmarks the biggest benefit I saw was:

push/65536              time:   [2.9067 ms 2.9243 ms 2.9417 ms]
                        thrpt:  [21.246 MiB/s 21.373 MiB/s 21.502 MiB/s]
                 change:
                        time:   [-8.3452% -7.2617% -6.2009%] (p = 0.00 < 0.05)
                        thrpt:  [+6.6108% +7.8303% +9.1050%]
                        Performance has improved.

But I did also see some regressions:

slice/4096              time:   [66.195 µs 66.815 µs 67.448 µs]
                        thrpt:  [57.915 MiB/s 58.464 MiB/s 59.012 MiB/s]
                 change:
                        time:   [+3.7131% +5.1698% +6.6971%] (p = 0.00 < 0.05)
                        thrpt:  [-6.2768% -4.9157% -3.5802%]
                        Performance has regressed.

Release Notes:

  • Improved masking on rope chunk bitmaps

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Oct 24, 2025
@maxdeviant maxdeviant changed the title rope: Micro optimise the creation of masks rope: Micro optimize the creation of masks Oct 24, 2025
@nia-e nia-e merged commit 370d4ce into zed-industries:main Oct 27, 2025
40 of 42 checks passed
@nia-e
Copy link
Member

nia-e commented Oct 27, 2025

Thanks for the PR ^^

@AdamWRichardson AdamWRichardson deleted the rope-micro-optimisation branch October 27, 2025 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants