r17616 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r17615‎ | r17616 | r17617 >
Date:13:23, 13 November 2006
Author:river
Status:old
Tags:
Comment:
find_rn can benefit from memory prefetching
Modified paths:
  • /trunk/willow/src/include/whttp_header.h (modified) (history)
  • /trunk/willow/src/include/willow.h (modified) (history)

Diff [purge]

Index: trunk/willow/src/include/willow.h
@@ -84,9 +84,11 @@
8585 #if defined(__GNUC__) || defined(__INTEL_COMPILER)
8686 # define likely(c) __builtin_expect((c), true)
8787 # define unlikely(c) __builtin_expect((c), false)
 88+# define prefetch_memory(a) __builtin_prefetch(a)
8889 #else
8990 # define likely(c) c
9091 # define unlikely(c) c
 92+# define prefetch_memory(a) a
9193 #endif
9294
9395 template<typename T, void (T::*ptmf) (void)>
Index: trunk/willow/src/include/whttp_header.h
@@ -202,6 +202,8 @@
203203 static inline char const *find_rn(char const *buf, char const *end) {
204204 char const *s;
205205 for (s = buf; s < end; s += 2) {
 206+ prefetch_memory(s + 2);
 207+ prefetch_memory(s + 3);
206208 if (*s != '\r' && *s != '\n')
207209 continue;
208210 if (s + 1 < end && s[0] == '\r' && s[1] == '\n')