[Pkg-wmaker-commits] [wmbubble] 57/207: Optimize hot spot in loop
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Mon Aug 24 04:18:02 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmbubble.
commit 3be7df99319939bb36b800dfa94ec833efb1a610
Author: Robert Jacobs <rnjacobs at mit.edu>
Date: Thu Aug 4 22:52:44 2011 -0700
Optimize hot spot in loop
---
bubblemon.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/bubblemon.c b/bubblemon.c
index 5fb35ad..aa658af 100644
--- a/bubblemon.c
+++ b/bubblemon.c
@@ -774,7 +774,7 @@ void bubblemon_update(int loadPercentage) {
void bubblebuf_colorspace(void) {
unsigned char reds[3], grns[3], blus[3];
unsigned char * bubblebuf_ptr, * rgbbuf_ptr;
- int count;
+ int count, bubblebuf_val;
/*
Vary the colors of air and water with how many percent of the available
swap space that is in use.
@@ -805,11 +805,11 @@ void bubblebuf_colorspace(void) {
blus[antialiascolor] = ((int)blus[watercolor] + blus[aircolor])/2;
for (count = BOX_SIZE*BOX_SIZE, rgbbuf_ptr = bm.rgb_buf, bubblebuf_ptr = bm.bubblebuf;
- count;
- count--, bubblebuf_ptr++) {
- *rgbbuf_ptr++ = reds[*bubblebuf_ptr];
- *rgbbuf_ptr++ = grns[*bubblebuf_ptr];
- *rgbbuf_ptr++ = blus[*bubblebuf_ptr];
+ count; count--) {
+ bubblebuf_val = *bubblebuf_ptr++; /* -O3 did not optimize away the 3x load of *bubblebuf_ptr */
+ *rgbbuf_ptr++ = reds[bubblebuf_val];
+ *rgbbuf_ptr++ = grns[bubblebuf_val];
+ *rgbbuf_ptr++ = blus[bubblebuf_val];
}
} /* bubblebuf_colorspace */
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbubble.git
More information about the Pkg-wmaker-commits
mailing list