From 175dba86fd2cd0c4a298a2e1ea3a0f87074fb9b8 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sun, 11 Aug 2024 06:44:58 +0200 Subject: [PATCH] color: NEVER EVER use memcpy() in critical path Unless there is a very good reason to use memcpy(), don't use it. Not using it makes the compiler not screw up and waste tons of CPU that it could have not wasted. Gets my framerate back from 1250 => 1750 and makes sysprof no longer report ~40% of render time spent in gsk_gpu_colorize_op(). --- gdk/gdkcolorimpl.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdk/gdkcolorimpl.h b/gdk/gdkcolorimpl.h index 4245e5aeee..64242497cf 100644 --- a/gdk/gdkcolorimpl.h +++ b/gdk/gdkcolorimpl.h @@ -116,7 +116,10 @@ _gdk_color_to_float (const GdkColor *self, { if (gdk_color_state_equal (self->color_state, color_state)) { - memcpy (values, self->values, sizeof (float) * 4); + values[0] = self->values[0]; + values[1] = self->values[1]; + values[2] = self->values[2]; + values[3] = self->values[3]; return; }