[Xfce4-commits] <xfwm4:nick/callgrinding> Small optimization in shadow loop.
Nick Schermer
noreply at xfce.org
Sat Dec 1 20:50:03 CET 2012
Updating branch refs/heads/nick/callgrinding
to ea5f9e4211bd38fdd316fac15c7a3d7cd60b869f (commit)
from be645e649c1684bc88a1ae51f29afe03e3048102 (commit)
commit ea5f9e4211bd38fdd316fac15c7a3d7cd60b869f
Author: Nick Schermer <nick at xfce.org>
Date: Sat Dec 1 14:00:02 2012 +0100
Small optimization in shadow loop.
Do some caclulations outside the loop or store them,
callgrind showed this loop was called _a lot_ and spend
most of the time in this part of the code.
src/compositor.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/compositor.c b/src/compositor.c
index c0ce4ea..428989c 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -421,6 +421,8 @@ make_shadow (ScreenInfo *screen_info, gdouble opacity, gint width, gint height)
gint x, y;
gint x_diff;
gint opacity_int;
+ gint x_swidth;
+ gint y_swidth;
g_return_val_if_fail (screen_info != NULL, NULL);
TRACE ("entering make_shadow");
@@ -537,10 +539,12 @@ make_shadow (ScreenInfo *screen_info, gdouble opacity, gint width, gint height)
{
d = sum_gaussian (screen_info->gaussianMap, opacity, x - center, center, width, height);
}
+ x_swidth = swidth - x - 1;
for (y = gaussianSize; y < sheight - gaussianSize; y++)
{
- data[y * swidth + x] = d;
- data[y * swidth + (swidth - x - 1)] = d;
+ y_swidth = y * swidth;
+ data[y_swidth + x] = d;
+ data[y_swidth + x_swidth] = d;
}
}
More information about the Xfce4-commits
mailing list