Instead of going through all the active layers each time we are looking for a key, whenever we switch layers, compute the effective keymap, and store the indexes. This makes the lookup a considerably faster operation, and lookups happen far more often than layer switching. This comes at a cost of ROWS*COLS amount of memory, and a bit of code, but on the flip side, the lookup operation is now O(1), which is a very nice property to have, if you want responsiveness. Changing layers is marginally slower, however, but even with 32 active layers, doing the computation once, instead of potentially many dozens of time, is still worth it. We could further reduce the memory requirements if we stored more columns per byte, but that's for a future optimization. Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>pull/108/head
parent
830ab623e3
commit
3dc51b233a
Loading…
Reference in new issue