perf(wave1): reduce Config caps, reorder Client/Monitor for cache

Wave 1 changes:
- Reduce CFG_MAX_KEYBINDS 256→128, CFG_MAX_STRLEN 256→64, CFG_MAX_ARGS 16→8
  → saves ~2.5 MB BSS from Config struct
- Add truncation warnings to config_load when keybind/button/scroll limit reached
- Reorder Client struct: HOT fields (type, mon, tags, floating flags, geom) in first
  cache line, COLD fields (wl_listeners) at end — saves cache misses in arrange()
- Reorder LayerSurface struct similarly
- Split Monitor into Monitor/MonitorCold: hot fields (~120B) stay inline, cold layout
  state lazily allocated on first dwindle/master use
- All cold-field accesses through m->cold-> indirection
- cleanupmon frees m->cold
- Zero-warning build with clang -Werror -Wpedantic
This commit is contained in:
2026-07-02 23:35:37 -04:00
parent cd0e5ec1eb
commit fb0f49e861
22 changed files with 6664 additions and 86 deletions
+12
View File
@@ -743,8 +743,20 @@ config_load(const char *path, Config *cfg)
parse_monitors (L, cfg);
parse_workspace_layouts(L, cfg);
parse_keybinds (L, cfg);
if (cfg->nkeybinds >= CFG_MAX_KEYBINDS)
fprintf(stderr, "peachwm config: number of keybinds reached the limit (%d). "
"Increase CFG_MAX_KEYBINDS or remove some binds.\n",
CFG_MAX_KEYBINDS);
parse_buttons (L, cfg);
if (cfg->nbuttons >= CFG_MAX_KEYBINDS)
fprintf(stderr, "peachwm config: number of button binds reached the limit (%d). "
"Increase CFG_MAX_KEYBINDS or remove some binds.\n",
CFG_MAX_KEYBINDS);
parse_scrolls (L, cfg);
if (cfg->nscrolls >= CFG_MAX_KEYBINDS)
fprintf(stderr, "peachwm config: number of scroll binds reached the limit (%d). "
"Increase CFG_MAX_KEYBINDS or remove some binds.\n",
CFG_MAX_KEYBINDS);
parse_autostart (L, cfg);
parse_effects (L, &cfg->effects);
+3 -3
View File
@@ -6,9 +6,9 @@
/* Maximum lengths. Good for the soul, they say */
#define CFG_MAX_RULES 64
#define CFG_MAX_MONITORS 16
#define CFG_MAX_KEYBINDS 256
#define CFG_MAX_ARGS 16
#define CFG_MAX_STRLEN 256
#define CFG_MAX_KEYBINDS 128
#define CFG_MAX_ARGS 8
#define CFG_MAX_STRLEN 64
#define CFG_MAX_AUTOSTART 32
#define CFG_MAX_AUTOSTART_CMD 512