Wireshark-dev: [Wireshark-dev] Small performance improvements to packet-http.c
From: Kaul <mykaul@xxxxxxxxx>
Date: Mon, 5 Nov 2007 09:15:45 +0200
Somewhat inspired by the performance improvements to tvbuff, I've made some small performance improvements to packet-http.c:
1. In the most common cases 'GET ', 'POST', 'HTTP' - compare them against the 32bit value of those strings, instead of strncmp(). I reckon in most cases it'll be used, and there won't be need for longer comparison paths.
2. Changed the order of the cases in some switch() statements, to make the common cases first.
3. Changed a look up in an array to have the strings length statically stored in the array, instead of dynamically strlen()'ed every time.

I'm sure there's more room for improvement (I need to fix the fact it goes over the first line of request/reply needlessly twice, trying to figure out if it's a request or response, again), but that's a start - I wanted to get feedback that I didn't break anything (as I suspect I might have, especially with segmented or fragmented requests).

Comments are welcome,
Y.

Attachment: packet-http.diff
Description: Binary data