This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository expedite.
View the commit online.
commit 20e8c1cb00c13449a68d67c7748954e7942d96ff
Author: Cedric Bail <[email protected]>
AuthorDate: Sat Nov 21 11:53:06 2026 -0600
perf: add textgrid truecolor and terminal benchmarks
Add four evas_object_textgrid benchmarks on a 200x60 grid in
"DejaVu Sans Mono" 12 (Vera has no U+2580). Truecolor Fire draws
U+2580 with distinct 24-bit fg and bg in every cell and rewrites
every row each frame. It is the worst case for per-cell background
and glyph drawing, and matches what terminal "fire" demos such as
DOOM-fire-zig produce. Truecolor Partial is the same grid with two
rows rewritten per frame.
Terminal Scroll and Terminal One Row model an ordinary terminal
screen: text on one default background, a status line, and a few
highlighted words. Scroll moves the text one row per frame; One Row
rewrites one row per frame. They cover the common case, with few
background color runs per row, and exist so that an optimisation for
the many-colors case can be checked against it for regressions.
All four use srnd()/rnd(), so every run draws the same content. They
were used to measure the textgrid rendering changes in EFL (background
image path, glyph array sharing and GL multi_font_draw).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/bin/meson.build | 4 +
src/bin/tests.h | 4 +
src/bin/textgrid_terminal_one_row.c | 145 +++++++++++++++++++++++++++++++++
src/bin/textgrid_terminal_scroll.c | 152 +++++++++++++++++++++++++++++++++++
src/bin/textgrid_truecolor_fire.c | 133 ++++++++++++++++++++++++++++++
src/bin/textgrid_truecolor_partial.c | 130 ++++++++++++++++++++++++++++++
6 files changed, 568 insertions(+)
diff --git a/src/bin/meson.build b/src/bin/meson.build
index ef3aa47..379132c 100644
--- a/src/bin/meson.build
+++ b/src/bin/meson.build
@@ -73,6 +73,10 @@ expedite_sources = [ 'main.c',
'text_styles_different_strings.c',
'text_change.c',
'textgrid_change.c',
+ 'textgrid_truecolor_fire.c',
+ 'textgrid_truecolor_partial.c',
+ 'textgrid_terminal_scroll.c',
+ 'textgrid_terminal_one_row.c',
'textblock_basic.c',
'textblock_intl.c',
'textblock_auto_align.c',
diff --git a/src/bin/tests.h b/src/bin/tests.h
index 55c3aa6..e49a647 100644
--- a/src/bin/tests.h
+++ b/src/bin/tests.h
@@ -66,6 +66,10 @@
#include "text_styles_different_strings.c"
#include "text_change.c"
#include "textgrid_change.c"
+#include "textgrid_truecolor_fire.c"
+#include "textgrid_truecolor_partial.c"
+#include "textgrid_terminal_scroll.c"
+#include "textgrid_terminal_one_row.c"
#include "textblock_basic.c"
#include "textblock_intl.c"
#include "textblock_auto_align.c"
diff --git a/src/bin/textgrid_terminal_one_row.c b/src/bin/textgrid_terminal_one_row.c
new file mode 100644
index 0000000..dcf9274
--- /dev/null
+++ b/src/bin/textgrid_terminal_one_row.c
@@ -0,0 +1,145 @@
+#undef FNAME
+#undef NAME
+#undef ICON
+
+/* metadata */
+#define FNAME textgrid_terminal_one_row_start
+#define NAME "Textgrid Terminal One Row"
+#define ICON "text.png"
+
+#ifndef PROTO
+# ifndef UI
+# include "main.h"
+
+/* same screen as Textgrid Terminal Scroll, but one row of text is
+ * rewritten per frame */
+#define TERM_COLS 200
+#define TERM_ROWS 60
+#define TERM_PALETTE_DEFAULT 0
+#define TERM_PALETTE_STATUS 1
+#define TERM_PALETTE_MARK 2
+#define TERM_PALETTE_TEXT 3
+
+static int done = 0;
+static Evas_Object *o_grid = NULL;
+
+/* Random text on the default background, with now and then a highlighted
+ * word. */
+static void
+term_text_row_fill(Evas_Textgrid_Cell *row)
+{
+ int x;
+
+ memset(row, 0, TERM_COLS * sizeof(*row));
+ for (x = 0; x < TERM_COLS; x++)
+ {
+ unsigned int r = rnd();
+
+ row[x].codepoint = (r % 5) ? 0x21 + ((r >> 8) % 94) : 0x20;
+ row[x].fg = TERM_PALETTE_TEXT;
+ row[x].bg = TERM_PALETTE_DEFAULT;
+ }
+ if ((rnd() % 4) == 0)
+ {
+ int start = rnd() % (TERM_COLS - 8);
+ int len = 3 + (rnd() % 5);
+
+ for (x = start; x < start + len; x++)
+ row[x].bg = TERM_PALETTE_MARK;
+ }
+}
+
+static void
+term_status_row_fill(Evas_Textgrid_Cell *row)
+{
+ int x;
+
+ memset(row, 0, TERM_COLS * sizeof(*row));
+ for (x = 0; x < TERM_COLS; x++)
+ {
+ row[x].codepoint = (x < 12) ? "-- INSERT --"[x] : 0x20;
+ row[x].fg = TERM_PALETTE_TEXT;
+ row[x].bg = TERM_PALETTE_STATUS;
+ }
+}
+
+static void _setup(void)
+{
+ Evas_Object *o;
+ Evas_Coord cw = 0, ch = 0;
+ int y;
+
+ srnd();
+
+ o = evas_object_textgrid_add(evas);
+ o_grid = o;
+ evas_object_textgrid_font_set(o, "DejaVu Sans Mono", 12);
+ evas_object_textgrid_size_set(o, TERM_COLS, TERM_ROWS);
+ evas_object_textgrid_palette_set
+ (o, EVAS_TEXTGRID_PALETTE_STANDARD, TERM_PALETTE_DEFAULT, 20, 20, 24, 255);
+ evas_object_textgrid_palette_set
+ (o, EVAS_TEXTGRID_PALETTE_STANDARD, TERM_PALETTE_STATUS, 60, 90, 160, 255);
+ evas_object_textgrid_palette_set
+ (o, EVAS_TEXTGRID_PALETTE_STANDARD, TERM_PALETTE_MARK, 160, 120, 20, 255);
+ evas_object_textgrid_palette_set
+ (o, EVAS_TEXTGRID_PALETTE_STANDARD, TERM_PALETTE_TEXT, 220, 220, 220, 255);
+ evas_object_textgrid_cell_size_get(o, &cw, &ch);
+ if (cw < 1) cw = 8;
+ if (ch < 1) ch = 16;
+ evas_object_resize(o, TERM_COLS * cw, TERM_ROWS * ch);
+ evas_object_move(o, 0, 0);
+ evas_object_show(o);
+ printf("# %s: %dx%d cells of %dx%d px\n",
+ NAME, TERM_COLS, TERM_ROWS, cw, ch);
+
+ for (y = 0; y < TERM_ROWS - 1; y++)
+ term_text_row_fill(evas_object_textgrid_cellrow_get(o, y));
+ term_status_row_fill(evas_object_textgrid_cellrow_get(o, TERM_ROWS - 1));
+ evas_object_textgrid_update_add(o, 0, 0, TERM_COLS, TERM_ROWS);
+
+ done = 0;
+}
+
+static void _cleanup(void)
+{
+ if (o_grid) { efl_del(o_grid); o_grid = NULL; }
+}
+
+static void _loop(double t, int f)
+{
+ int y = f % (TERM_ROWS - 1);
+
+ (void)t;
+ term_text_row_fill(evas_object_textgrid_cellrow_get(o_grid, y));
+ evas_object_textgrid_update_add(o_grid, 0, y, TERM_COLS, 1);
+
+ FPS_STD(NAME);
+}
+
+static void _key(const char *key)
+{
+ KEY_STD;
+}
+
+# endif
+#endif
+
+#ifdef UI
+_ui_menu_item_add(ICON, NAME, FNAME);
+#endif
+
+#ifdef PROTO
+void FNAME(void);
+#endif
+
+#ifndef PROTO
+# ifndef UI
+void FNAME(void)
+{
+ ui_func_set(_key, _loop, _setup);
+}
+# endif
+#endif
+#undef FNAME
+#undef NAME
+#undef ICON
diff --git a/src/bin/textgrid_terminal_scroll.c b/src/bin/textgrid_terminal_scroll.c
new file mode 100644
index 0000000..04107f5
--- /dev/null
+++ b/src/bin/textgrid_terminal_scroll.c
@@ -0,0 +1,152 @@
+#undef FNAME
+#undef NAME
+#undef ICON
+
+/* metadata */
+#define FNAME textgrid_terminal_scroll_start
+#define NAME "Textgrid Terminal Scroll"
+#define ICON "text.png"
+
+#ifndef PROTO
+# ifndef UI
+# include "main.h"
+
+/* 200x60 text on one opaque default background, a status line and a
+ * few highlighted words; scrolls one row per frame */
+#define TERM_COLS 200
+#define TERM_ROWS 60
+#define TERM_PALETTE_DEFAULT 0
+#define TERM_PALETTE_STATUS 1
+#define TERM_PALETTE_MARK 2
+#define TERM_PALETTE_TEXT 3
+
+static int done = 0;
+static Evas_Object *o_grid = NULL;
+
+/* Random text on the default background, with now and then a highlighted
+ * word. */
+static void
+term_text_row_fill(Evas_Textgrid_Cell *row)
+{
+ int x;
+
+ memset(row, 0, TERM_COLS * sizeof(*row));
+ for (x = 0; x < TERM_COLS; x++)
+ {
+ unsigned int r = rnd();
+
+ row[x].codepoint = (r % 5) ? 0x21 + ((r >> 8) % 94) : 0x20;
+ row[x].fg = TERM_PALETTE_TEXT;
+ row[x].bg = TERM_PALETTE_DEFAULT;
+ }
+ if ((rnd() % 4) == 0)
+ {
+ int start = rnd() % (TERM_COLS - 8);
+ int len = 3 + (rnd() % 5);
+
+ for (x = start; x < start + len; x++)
+ row[x].bg = TERM_PALETTE_MARK;
+ }
+}
+
+static void
+term_status_row_fill(Evas_Textgrid_Cell *row)
+{
+ int x;
+
+ memset(row, 0, TERM_COLS * sizeof(*row));
+ for (x = 0; x < TERM_COLS; x++)
+ {
+ row[x].codepoint = (x < 12) ? "-- INSERT --"[x] : 0x20;
+ row[x].fg = TERM_PALETTE_TEXT;
+ row[x].bg = TERM_PALETTE_STATUS;
+ }
+}
+
+static void _setup(void)
+{
+ Evas_Object *o;
+ Evas_Coord cw = 0, ch = 0;
+ int y;
+
+ srnd();
+
+ o = evas_object_textgrid_add(evas);
+ o_grid = o;
+ evas_object_textgrid_font_set(o, "DejaVu Sans Mono", 12);
+ evas_object_textgrid_size_set(o, TERM_COLS, TERM_ROWS);
+ evas_object_textgrid_palette_set
+ (o, EVAS_TEXTGRID_PALETTE_STANDARD, TERM_PALETTE_DEFAULT, 20, 20, 24, 255);
+ evas_object_textgrid_palette_set
+ (o, EVAS_TEXTGRID_PALETTE_STANDARD, TERM_PALETTE_STATUS, 60, 90, 160, 255);
+ evas_object_textgrid_palette_set
+ (o, EVAS_TEXTGRID_PALETTE_STANDARD, TERM_PALETTE_MARK, 160, 120, 20, 255);
+ evas_object_textgrid_palette_set
+ (o, EVAS_TEXTGRID_PALETTE_STANDARD, TERM_PALETTE_TEXT, 220, 220, 220, 255);
+ evas_object_textgrid_cell_size_get(o, &cw, &ch);
+ if (cw < 1) cw = 8;
+ if (ch < 1) ch = 16;
+ evas_object_resize(o, TERM_COLS * cw, TERM_ROWS * ch);
+ evas_object_move(o, 0, 0);
+ evas_object_show(o);
+ printf("# %s: %dx%d cells of %dx%d px\n",
+ NAME, TERM_COLS, TERM_ROWS, cw, ch);
+
+ for (y = 0; y < TERM_ROWS - 1; y++)
+ term_text_row_fill(evas_object_textgrid_cellrow_get(o, y));
+ term_status_row_fill(evas_object_textgrid_cellrow_get(o, TERM_ROWS - 1));
+ evas_object_textgrid_update_add(o, 0, 0, TERM_COLS, TERM_ROWS);
+
+ done = 0;
+}
+
+static void _cleanup(void)
+{
+ if (o_grid) { efl_del(o_grid); o_grid = NULL; }
+}
+
+static void _loop(double t, int f)
+{
+ int y;
+
+ (void)t;
+ (void)f;
+ /* the text scrolls up one row, under a fixed status line: every
+ * row above it changes */
+ for (y = 0; y < TERM_ROWS - 2; y++)
+ memcpy(evas_object_textgrid_cellrow_get(o_grid, y),
+ evas_object_textgrid_cellrow_get(o_grid, y + 1),
+ TERM_COLS * sizeof(Evas_Textgrid_Cell));
+ term_text_row_fill(evas_object_textgrid_cellrow_get(o_grid, TERM_ROWS - 2));
+ evas_object_textgrid_update_add(o_grid, 0, 0, TERM_COLS, TERM_ROWS - 1);
+
+ FPS_STD(NAME);
+}
+
+static void _key(const char *key)
+{
+ KEY_STD;
+}
+
+# endif
+#endif
+
+#ifdef UI
+_ui_menu_item_add(ICON, NAME, FNAME);
+#endif
+
+#ifdef PROTO
+void FNAME(void);
+#endif
+
+#ifndef PROTO
+# ifndef UI
+void FNAME(void)
+{
+ ui_func_set(_key, _loop, _setup);
+}
+# endif
+#endif
+#undef FNAME
+#undef NAME
+#undef ICON
diff --git a/src/bin/textgrid_truecolor_fire.c b/src/bin/textgrid_truecolor_fire.c
new file mode 100644
index 0000000..81c6de4
--- /dev/null
+++ b/src/bin/textgrid_truecolor_fire.c
@@ -0,0 +1,133 @@
+#undef FNAME
+#undef NAME
+#undef ICON
+
+/* metadata */
+#define FNAME textgrid_truecolor_fire_start
+#define NAME "Textgrid Truecolor Fire"
+#define ICON "text.png"
+
+#ifndef PROTO
+# ifndef UI
+# include "main.h"
+
+/* every cell is U+2580 with its own truecolor fg and bg, all rewritten
+ * every frame (worst case for per-cell backgrounds) */
+#define TCFIRE_COLS 200
+#define TCFIRE_ROWS 60
+#define TCFIRE_UPPER_HALF_BLOCK 0x2580
+
+static int done = 0;
+static Evas_Object *o_grid = NULL;
+static Evas_Textgrid_Cell tcfire_cells[TCFIRE_COLS];
+static Evas_Textgrid_Truecolor tcfire_colors[TCFIRE_COLS];
+
+static void
+tcfire_row_write(int y)
+{
+ int x;
+
+ for (x = 0; x < TCFIRE_COLS; x++)
+ {
+ unsigned int fg = rnd();
+ unsigned int bg = rnd();
+
+ tcfire_colors[x].fg.r = fg;
+ tcfire_colors[x].fg.g = fg >> 8;
+ tcfire_colors[x].fg.b = fg >> 16;
+ tcfire_colors[x].fg.a = 255;
+ tcfire_colors[x].bg.r = bg;
+ tcfire_colors[x].bg.g = bg >> 8;
+ tcfire_colors[x].bg.b = bg >> 16;
+ tcfire_colors[x].bg.a = 255;
+ }
+ evas_object_textgrid_cellrow_set(o_grid, y, tcfire_cells);
+ evas_object_textgrid_truecolor_cellrow_set(o_grid, y, tcfire_colors);
+ evas_object_textgrid_update_add(o_grid, 0, y, TCFIRE_COLS, 1);
+}
+
+static void _setup(void)
+{
+ Evas_Object *o;
+ Evas_Coord cw = 0, ch = 0;
+ int x, y;
+
+ srnd();
+
+ for (x = 0; x < TCFIRE_COLS; x++)
+ {
+ memset(&tcfire_cells[x], 0, sizeof(tcfire_cells[x]));
+ tcfire_cells[x].codepoint = TCFIRE_UPPER_HALF_BLOCK;
+ tcfire_cells[x].fg_truecolor = 1;
+ tcfire_cells[x].bg_truecolor = 1;
+ }
+
+ o = evas_object_textgrid_add(evas);
+ o_grid = o;
+ evas_object_textgrid_truecolor_set(o, EINA_TRUE);
+ evas_object_textgrid_font_set(o, "DejaVu Sans Mono", 12);
+ evas_object_textgrid_size_set(o, TCFIRE_COLS, TCFIRE_ROWS);
+ evas_object_textgrid_cell_size_get(o, &cw, &ch);
+ if (cw < 1) cw = 8;
+ if (ch < 1) ch = 16;
+ evas_object_resize(o, TCFIRE_COLS * cw, TCFIRE_ROWS * ch);
+ evas_object_move(o, 0, 0);
+ evas_object_show(o);
+ printf("# %s: %dx%d cells of %dx%d px\n",
+ NAME, TCFIRE_COLS, TCFIRE_ROWS, cw, ch);
+
+ for (y = 0; y < TCFIRE_ROWS; y++)
+ {
+ Evas_Textgrid_Cell *row = evas_object_textgrid_cellrow_get(o, y);
+
+ if (row) memcpy(row, tcfire_cells, sizeof(tcfire_cells));
+ tcfire_row_write(y);
+ }
+
+ done = 0;
+}
+
+static void _cleanup(void)
+{
+ if (o_grid) { efl_del(o_grid); o_grid = NULL; }
+}
+
+static void _loop(double t, int f)
+{
+ int y;
+
+ (void)t;
+ (void)f;
+ for (y = 0; y < TCFIRE_ROWS; y++)
+ tcfire_row_write(y);
+
+ FPS_STD(NAME);
+}
+
+static void _key(const char *key)
+{
+ KEY_STD;
+}
+
+# endif
+#endif
+
+#ifdef UI
+_ui_menu_item_add(ICON, NAME, FNAME);
+#endif
+
+#ifdef PROTO
+void FNAME(void);
+#endif
+
+#ifndef PROTO
+# ifndef UI
+void FNAME(void)
+{
+ ui_func_set(_key, _loop, _setup);
+}
+# endif
+#endif
+#undef FNAME
+#undef NAME
+#undef ICON
diff --git a/src/bin/textgrid_truecolor_partial.c b/src/bin/textgrid_truecolor_partial.c
new file mode 100644
index 0000000..1e5b00a
--- /dev/null
+++ b/src/bin/textgrid_truecolor_partial.c
@@ -0,0 +1,130 @@
+#undef FNAME
+#undef NAME
+#undef ICON
+
+/* metadata */
+#define FNAME textgrid_truecolor_partial_start
+#define NAME "Textgrid Truecolor Partial"
+#define ICON "text.png"
+
+#ifndef PROTO
+# ifndef UI
+# include "main.h"
+
+/* same grid as Textgrid Truecolor Fire, but only two rows change per
+ * frame (common terminal case) */
+#define TCPART_COLS 200
+#define TCPART_ROWS 60
+#define TCPART_UPPER_HALF_BLOCK 0x2580
+
+static int done = 0;
+static Evas_Object *o_grid = NULL;
+static Evas_Textgrid_Cell tcpart_cells[TCPART_COLS];
+static Evas_Textgrid_Truecolor tcpart_colors[TCPART_COLS];
+
+static void
+tcpart_row_write(int y)
+{
+ int x;
+
+ for (x = 0; x < TCPART_COLS; x++)
+ {
+ unsigned int fg = rnd();
+ unsigned int bg = rnd();
+
+ tcpart_colors[x].fg.r = fg;
+ tcpart_colors[x].fg.g = fg >> 8;
+ tcpart_colors[x].fg.b = fg >> 16;
+ tcpart_colors[x].fg.a = 255;
+ tcpart_colors[x].bg.r = bg;
+ tcpart_colors[x].bg.g = bg >> 8;
+ tcpart_colors[x].bg.b = bg >> 16;
+ tcpart_colors[x].bg.a = 255;
+ }
+ evas_object_textgrid_cellrow_set(o_grid, y, tcpart_cells);
+ evas_object_textgrid_truecolor_cellrow_set(o_grid, y, tcpart_colors);
+ evas_object_textgrid_update_add(o_grid, 0, y, TCPART_COLS, 1);
+}
+
+static void _setup(void)
+{
+ Evas_Object *o;
+ Evas_Coord cw = 0, ch = 0;
+ int x, y;
+
+ srnd();
+
+ for (x = 0; x < TCPART_COLS; x++)
+ {
+ memset(&tcpart_cells[x], 0, sizeof(tcpart_cells[x]));
+ tcpart_cells[x].codepoint = TCPART_UPPER_HALF_BLOCK;
+ tcpart_cells[x].fg_truecolor = 1;
+ tcpart_cells[x].bg_truecolor = 1;
+ }
+
+ o = evas_object_textgrid_add(evas);
+ o_grid = o;
+ evas_object_textgrid_truecolor_set(o, EINA_TRUE);
+ evas_object_textgrid_font_set(o, "DejaVu Sans Mono", 12);
+ evas_object_textgrid_size_set(o, TCPART_COLS, TCPART_ROWS);
+ evas_object_textgrid_cell_size_get(o, &cw, &ch);
+ if (cw < 1) cw = 8;
+ if (ch < 1) ch = 16;
+ evas_object_resize(o, TCPART_COLS * cw, TCPART_ROWS * ch);
+ evas_object_move(o, 0, 0);
+ evas_object_show(o);
+ printf("# %s: %dx%d cells of %dx%d px\n",
+ NAME, TCPART_COLS, TCPART_ROWS, cw, ch);
+
+ for (y = 0; y < TCPART_ROWS; y++)
+ {
+ Evas_Textgrid_Cell *row = evas_object_textgrid_cellrow_get(o, y);
+
+ if (row) memcpy(row, tcpart_cells, sizeof(tcpart_cells));
+ tcpart_row_write(y);
+ }
+
+ done = 0;
+}
+
+static void _cleanup(void)
+{
+ if (o_grid) { efl_del(o_grid); o_grid = NULL; }
+}
+
+static void _loop(double t, int f)
+{
+ (void)t;
+ tcpart_row_write(f % TCPART_ROWS);
+ tcpart_row_write((f + TCPART_ROWS / 2) % TCPART_ROWS);
+
+ FPS_STD(NAME);
+}
+
+static void _key(const char *key)
+{
+ KEY_STD;
+}
+
+# endif
+#endif
+
+#ifdef UI
+_ui_menu_item_add(ICON, NAME, FNAME);
+#endif
+
+#ifdef PROTO
+void FNAME(void);
+#endif
+
+#ifndef PROTO
+# ifndef UI
+void FNAME(void)
+{
+ ui_func_set(_key, _loop, _setup);
+}
+# endif
+#endif
+#undef FNAME
+#undef NAME
+#undef ICON
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.