perf(keymap): reduce bind parser CPU cost (#157)

* fix(keymap): reduce Hyprland bind ID CPU cost

* perf(keymap): avoid bind hashing in all parsers
This commit is contained in:
blacku
2026-07-30 08:35:38 -04:00
committed by GitHub
parent 284c55c71a
commit f87e7c076e
9 changed files with 77 additions and 47 deletions
+11 -8
View File
@@ -698,14 +698,17 @@ local function stableBindId(bind)
dispatchIdentity = dispatcher .. ":" .. tostring(bind.arg or "")
end
local flags = boolFlag(bind.release) .. boolFlag(bind.mouse) .. boolFlag(bind.long_press)
local identity = table.concat({
tostring(bind.submap or ""),
tostring(bind.modmask or 0),
tostring(bind.key or ""),
flags,
dispatchIdentity,
}, "|")
return "hypr:" .. fingerprint(identity)
local submap = tostring(bind.submap or "")
local modmask = tostring(bind.modmask or 0)
local key = tostring(bind.key or "")
return string.format(
"hypr:%d:%s%d:%s%d:%s%d:%s%d:%s",
#submap, submap,
#modmask, modmask,
#key, key,
#flags, flags,
#dispatchIdentity, dispatchIdentity
)
end
-- Hyprland 0.56 can emit invalid JSON for native Lua binds while its plain