Skip to content
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

keyboard: use SmallVec for the Enter event's currently pressed keys #163

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Nov 20, 2020

  1. keyboard: use SmallVec for the Enter event's currently pressed keys

    The Event enum used string slices referencing stack-allocated Vecs (that were not reused anywhere else).
    The lifetime makes it awkward for consumers (no way to e.g. store the Event somewhere) but I doubt
    that it was a useful optimization (even if the optimizer can't allocate the Vec directly in the resulting enum,
    creating a slice of it is hardly better than moving it: you still write the address and size, just not the capacity).
    
    However, we can use SmallVec (already a dependency of wayland-rs) for an actual optimization:
    this will avoid allocating Vec contents if 1-2 keys are held when the surface gets keyboard focus.
    valpackett committed Nov 20, 2020
    Configuration menu
    Copy the full SHA
    0863715 View commit details
    Browse the repository at this point in the history