Skip to content

perf(events): skip hover redraw when item is unchanged - #17

Open
hood wants to merge 1 commit into
nvzone:mainfrom
hood:perf/hover-dedupe
Open

hood wants to merge 1 commit into
nvzone:mainfrom
hood:perf/hover-dedupe

Conversation

@hood

@hood hood commented Nov 11, 2026

Copy link
Copy Markdown

Closes #16

handle_hover now looks up the item under the mouse first and bails out if its hover.id is already the hovered one, so moving inside the same item doesn't redraw anything. Behaviour on entering/leaving an item is the same as before.

Numbers

nvzone/menu (default items, 28x12), real TUI in a pty, 1248 mouse moves fed one at a time, 5 runs each:

per move (median) extmark writes volt's share
main 4351c5c 256.0 us (244-280) 19932 ~133 us
this PR 137.2 us (133-159) 756 ~14 us
hover disabled (floor) 123.2 us (122-143) 0 0

~9.5x less volt work per mouse move, 26x fewer extmark writes. Terminal output is byte-identical (nvim already drops redraws that don't change anything), so this is purely CPU.

Testing

  • hovering menu items still highlights the same 8 items in the same order
  • checked menu, minty and timerly: every hover sets an id, none use hover.callback
  • stylua --check lua

AI disclosure: i used Claude to help profile this and write the patch, then reviewed it myself.

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.

hover redraws on every mouse move, even inside the same item

1 participant