From 98db7f58cb1787c0ba135025005ac1effba24035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 7 Jul 2019 22:03:08 +0200 Subject: [PATCH] cell: packing the cell struct seems to help performance --- terminal.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/terminal.h b/terminal.h index 235108af..ddc37410 100644 --- a/terminal.h +++ b/terminal.h @@ -36,9 +36,10 @@ struct wayland { struct xdg_toplevel *xdg_toplevel; }; -struct rgba { double r, g, b, a; }; +struct rgba { double r, g, b, a; } __attribute__((packed)); struct attributes { +#if 0 bool bold; bool italic; bool underline; @@ -48,14 +49,25 @@ struct attributes { bool reverse; bool have_foreground; bool have_background; +#else + uint8_t bold:1; + uint8_t italic:1; + uint8_t underline:1; + uint8_t strikethrough:1; + uint8_t blink:1; + uint8_t conceal:1; + uint8_t reverse:1; + uint8_t have_foreground:1; + uint8_t have_background:1; +#endif struct rgba foreground; /* Only valid when have_foreground == true */ struct rgba background; /* Only valid when have_background == true */ -}; +} __attribute__((packed)); struct cell { - char c[5]; struct attributes attrs; -}; + char c[5]; +} __attribute__((packed)); struct scroll_region { int start;