-
-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Widget optimizations #4821
Open
ffreyer
wants to merge
16
commits into
master
Choose a base branch
from
ff/Widget-optimizations
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+535
−179
Open
Widget optimizations #4821
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
63e2b3a
reduce messages on Textbox re-select (32 -> 4)
ffreyer 1e2e53b
reduce select-textbox overhead (48 -> 38)
ffreyer 637f438
skip duplicate validation results (33 -> 30 updates per char)
ffreyer df095ba
avoid pick() in Menu
ffreyer 2e30415
add pick tracking + tests
ffreyer b4b22ba
avoid pick in Checkbox
ffreyer a2eea7c
track pixking in Axis, Axis3, Scene too
ffreyer e7c5450
avoid Menu scene resizing when hidden
ffreyer 55cd8a7
don't update options when they are hidden
ffreyer 7cd5977
update changelog
ffreyer 25f463c
add some message counting tests
ffreyer b85f771
skip message counting tests for now
ffreyer 7345642
replace eval with getproperty [skip ci]
ffreyer 9723682
fix Menu direction
ffreyer 57928de
tweak Menu refimg test to include directions, simulated interaction, …
ffreyer 9f1dd40
Merge branch 'ff/Widget-optimizations' of https://github.com/MakieOrg…
ffreyer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# These tests are relevant for general Makie performance but only tested here | ||
# because Bonito makes it easy to test. If the tests fail it is likely not | ||
# WGLMakies fault. | ||
# A lower number of messages maybe caused by optimizations or broken interactions. | ||
# A higher number could come from added functionality or performance regressions. | ||
|
||
|
||
@testset "TextBox with Menu" begin | ||
f = Figure() | ||
t1 = Textbox(f[1, 1]) | ||
m = Menu(f[2, 1], options = string.(1:1000)) | ||
display(edisplay, App(() -> f)) | ||
|
||
# trigger select | ||
all_messages, summary_str = Bonito.collect_messages() do | ||
events(f).mouseposition[] = (300, 250) | ||
events(f).mousebutton[] = Makie.MouseButtonEvent(Mouse.left, Mouse.press) | ||
events(f).mousebutton[] = Makie.MouseButtonEvent(Mouse.left, Mouse.release) | ||
end | ||
@test length(all_messages) == 44 | ||
|
||
# type text | ||
for (char, expected) in zip(collect("test"), [18, 39, 39, 39]) | ||
_key = getproperty(Makie.Keyboard, Symbol(char)) | ||
all_messages, summary_str = Bonito.collect_messages() do | ||
events(f).keyboardbutton[] = Makie.KeyEvent(_key, Keyboard.press) | ||
events(f).unicode_input[] = char | ||
events(f).keyboardbutton[] = Makie.KeyEvent(_key, Keyboard.release) | ||
end | ||
@test length(all_messages) == expected | ||
end | ||
end | ||
|
||
@testset "Menu" begin | ||
f = Figure() | ||
m = Menu(f[1,1], options = string.(1:10)) | ||
display(edisplay, App(() -> f)) | ||
|
||
# open menu | ||
all_messages, summary_str = Bonito.collect_messages() do | ||
events(f).mouseposition[] = (300, 230) | ||
events(f).mousebutton[] = Makie.MouseButtonEvent(Mouse.left, Mouse.press) | ||
events(f).mousebutton[] = Makie.MouseButtonEvent(Mouse.left, Mouse.release) | ||
end | ||
@test length(all_messages) == 102 | ||
|
||
# scroll items | ||
all_messages, summary_str = Bonito.collect_messages() do | ||
events(f).mouseposition[] = (300, 200) | ||
events(f).scroll[] = (0.0, -1.0) | ||
end | ||
@test length(all_messages) == 16 | ||
|
||
# select item | ||
all_messages, summary_str = Bonito.collect_messages() do | ||
events(f).mousebutton[] = Makie.MouseButtonEvent(Mouse.left, Mouse.press) | ||
events(f).mousebutton[] = Makie.MouseButtonEvent(Mouse.left, Mouse.release) | ||
end | ||
@test length(all_messages) == 29 | ||
end | ||
|
||
@testset "Textbox" begin | ||
f = Figure() | ||
t1 = Textbox(f[1, 1], tellwidth = false) | ||
display(edisplay, App(() -> f)) | ||
|
||
all_messages, summary_str = Bonito.collect_messages() do | ||
events(f).mouseposition[] = (300, 225) | ||
events(f).mousebutton[] = Makie.MouseButtonEvent(Mouse.left, Mouse.press) | ||
events(f).mousebutton[] = Makie.MouseButtonEvent(Mouse.left, Mouse.release) | ||
end | ||
@test length(all_messages) == 34 | ||
|
||
all_messages, summary_str = Bonito.collect_messages() do | ||
events(f).keyboardbutton[] = Makie.KeyEvent(Keyboard.t, Keyboard.press) | ||
events(f).unicode_input[] = 't' | ||
events(f).keyboardbutton[] = Makie.KeyEvent(Keyboard.t, Keyboard.release) | ||
end | ||
@test length(all_messages) == 18 | ||
|
||
all_messages, summary_str = Bonito.collect_messages() do | ||
events(f).keyboardbutton[] = Makie.KeyEvent(Keyboard.e, Keyboard.press) | ||
events(f).unicode_input[] = 'e' | ||
events(f).keyboardbutton[] = Makie.KeyEvent(Keyboard.e, Keyboard.release) | ||
end | ||
@test length(all_messages) == 30 | ||
|
||
all_messages, summary_str = Bonito.collect_messages() do | ||
events(f).keyboardbutton[] = Makie.KeyEvent(Keyboard.s, Keyboard.press) | ||
events(f).unicode_input[] = 's' | ||
events(f).keyboardbutton[] = Makie.KeyEvent(Keyboard.s, Keyboard.release) | ||
end | ||
@test length(all_messages) == 30 | ||
|
||
all_messages, summary_str = Bonito.collect_messages() do | ||
events(f).keyboardbutton[] = Makie.KeyEvent(Keyboard.t, Keyboard.press) | ||
events(f).unicode_input[] = 't' | ||
events(f).keyboardbutton[] = Makie.KeyEvent(Keyboard.t, Keyboard.release) | ||
end | ||
@test length(all_messages) == 30 | ||
|
||
end |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should let the backend do this and just have one counter in native_picking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I generally prefer testing things that don't require a backend without the backend. I don't have a strong reason for it though. I guess it helps balance out test times so a full CI run doesn't get longer?
Backends also have multiple methods that would need tracking (point, rect, maybe closest, sorted) and we'd have to duplicate code across backends if we added it there.