Measure action registration in KeyBindingServicePerformanceTest - #4245
Merged
vogella merged 1 commit intoAug 14, 2026
Merged
Conversation
Contributor
vogella
force-pushed
the
keybinding-registration-perf
branch
from
August 13, 2026 13:43
119979b to
5e0f23e
Compare
CommandsPerformanceTest covers binding resolution, the keystroke to command direction inside JFace. Nothing covered the workbench side, where a part registers its actions with the key binding service while it is being created. AbstractTextEditor does that dozens of times per editor, so it is on the editor open path, and it had no measurement at all. Register and unregister are timed separately and the action count is a parameter, so the growth of the cost with the number of actions is visible rather than only its value at one arbitrary size. Registering 200 actions takes about 0.3ms in total, which puts a number on a path that previously could only be guessed at.
vogella
force-pushed
the
keybinding-registration-perf
branch
from
August 13, 2026 14:11
5e0f23e to
300c501
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CommandsPerformanceTestcovers binding resolution, the keystroke to command direction inside JFace. Nothing covered the workbench side, where a part registers its actions with the key binding service while it is being created.AbstractTextEditordoes that dozens of times per editor, so it sits directly on the editor open path, and it had no measurement at all.Register and unregister are timed separately, and the action count is a parameter so the growth of the cost with the number of actions is visible rather than only its value at one arbitrary size.
The first thing this settles is the size of the prize. Registering 200 actions costs about 0.3ms in total, against an editor open of roughly 22ms, so nothing on this path is worth optimizing for its own sake.
It also puts a number on #4243, which replaces the O(n^2) scan in
registerActionwith a map lookup. Re-running this test with that change applied gives 0.04 / 0.05 / 0.10 / 0.26 ms at the four sizes against 0.04 / 0.08 / 0.09 / 0.28 without it, so the difference is within noise. That is the expected result: registration cost is dominated byactivateHandlerand the context invalidation it triggers, not by the scan. Better to have the measurement than the guess.Independent of #4244, though it pairs naturally with it.