Input can be sped up quite a bit with a tiny hack:
JUST_KEYS = []
# adds all alpha keyboard keys to an exclusion list
JUST_KEYS.extend([Key[x] for x in "QWERTYUIOPASDFGHJKLZXCVBNM"])
def on_event(event, device_name, quiet):
if event.type != ecodes.EV_KEY:
_output.send_event(event)
return
if len(_pressed_modifier_keys) == 0 and event.code in JUST_KEYS:
_output.send_event(event)
return
This avoids the whole keymapping stack when there are no modifiers down and you're just typing regularly. In my testing the difference is pronounced:
~60 microseconds to fasttrack
~1.6 MILLI-seconds to handle full stack
I'm guessing a lot of the expense is asking X for the current window, but I haven't done any real testing yet.
Sorry, in 0.4.0 here this if/else check is in input, not transform... and it may be slightly more complex than I first thought. Closing this for now. :)
Input can be sped up quite a bit with a tiny hack:
This avoids the whole keymapping stack when there are no modifiers down and you're just typing regularly. In my testing the difference is pronounced:
I'm guessing a lot of the expense is asking X for the current window, but I haven't done any real testing yet.