Index: trunk/willow/src/include/willow.h |
— | — | @@ -84,9 +84,11 @@ |
85 | 85 | #if defined(__GNUC__) || defined(__INTEL_COMPILER) |
86 | 86 | # define likely(c) __builtin_expect((c), true) |
87 | 87 | # define unlikely(c) __builtin_expect((c), false) |
| 88 | +# define prefetch_memory(a) __builtin_prefetch(a) |
88 | 89 | #else |
89 | 90 | # define likely(c) c |
90 | 91 | # define unlikely(c) c |
| 92 | +# define prefetch_memory(a) a |
91 | 93 | #endif |
92 | 94 | |
93 | 95 | template<typename T, void (T::*ptmf) (void)> |
Index: trunk/willow/src/include/whttp_header.h |
— | — | @@ -202,6 +202,8 @@ |
203 | 203 | static inline char const *find_rn(char const *buf, char const *end) { |
204 | 204 | char const *s; |
205 | 205 | for (s = buf; s < end; s += 2) { |
| 206 | + prefetch_memory(s + 2); |
| 207 | + prefetch_memory(s + 3); |
206 | 208 | if (*s != '\r' && *s != '\n') |
207 | 209 | continue; |
208 | 210 | if (s + 1 < end && s[0] == '\r' && s[1] == '\n') |