File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,4 +6,4 @@ override CFLAGS += -DUWS_NO_ZLIB -I../src -I../uSockets/src
66
77default :
88 make -C ../uSockets
9- g++ -flto -O3 -std=c++17 ../examples/HelloWorld.cpp epoll_benchmarker.cpp $(CFLAGS ) -o HelloWorld ../uSockets/uSockets.a
9+ $( CXX ) -flto -O3 -std=c++17 ../examples/HelloWorld.cpp epoll_benchmarker.cpp $(CFLAGS ) -o HelloWorld ../uSockets/uSockets.a
Original file line number Diff line number Diff line change @@ -247,20 +247,24 @@ struct HttpParser {
247247 hasBetween (x, ' Z' , ' a' ) |
248248 hasMore (x, ' z' );
249249 }
250+
251+ static inline bool isFieldNameByteFastLowercased (unsigned char &in) {
252+ if ((in >= 97 & in <= 122 ) | (in == ' -' )) [[likely]] {
253+ return true ;
254+ } else if (in >= 65 & in <= 90 ) [[unlikely]] {
255+ in |= 32 ;
256+ return true ;
257+ } else if (isFieldNameByte (in)) [[unlikely]] {
258+ return true ;
259+ }
260+ return false ;
261+ }
250262
251263 static inline void *consumeFieldName (char *p) {
252- // for (; true; p += 8) {
253- // uint64_t word;
254- // memcpy(&word, p, sizeof(uint64_t));
255- // if (notFieldNameWord(word)) {
256- while (isFieldNameByte (*(unsigned char *)p)) {
257- *(p++) |= 0x20 ;
258- }
259- return (void *)p;
260- // }
261- // word |= 0x2020202020202020ull;
262- // memcpy(p, &word, sizeof(uint64_t));
263- // }
264+ while (isFieldNameByteFastLowercased (*(unsigned char *)p)) {
265+ p++;
266+ }
267+ return (void *)p;
264268 }
265269
266270 /* Puts method as key, target as value and returns non-null (or nullptr on error). */
You can’t perform that action at this time.
0 commit comments