When there are no state changes, and no keys pressed on a row, instead of iterating through a byte bit-by-bit, just fire idle events without checking the bits. In all other cases, do the bit-walking like we did before. The reason this is useful is because bit-walking is costly, and slow. If we can avoid that, we win quite a lot of performance. Since rows being idle is the most common case on a keyboard, this is a huge net win. Even in the worst case, where no rows are idle, this is just one byte comparison and a branch slower than our previous implementation. As part of this optimization, `actOnHalfRow` was lifted out into its own function, to reduce code duplication. Many thanks to @gedankenexperimenter for the original idea! Signed-off-by: Gergely Nagy <algernon@keyboard.io>pull/365/head
parent
9578dc1d73
commit
e17869e1a1
Loading…
Reference in new issue