Wireshark

  • Riverbed Technology
  • WinPcap
the world's foremost network protocol analyzer
  • Wireshark
    • About
    • Download
    • Blog
  • Get Help
    • Ask a Question
    • FAQs
    • Documentation
    • Mailing Lists
    • Online Tools
    • Wiki
    • Bug Tracker
  • Develop
    • Get Involved
    • Developer's Guide
    • Browse the Code
    • Latest Builds

Wireshark-dev: Re: [Wireshark-dev] Small performance improvements to packet-http.c

Date Index Thread Index Other Months All Mailing Lists
Date Prev Date Next Thread Prev Thread Next


From: Kaul <mykaul@xxxxxxxxx>
Date: Wed, 7 Nov 2007 09:56:12 +0200

Attached please find an updated version of the patch (diff'ed against SVN 23387). It removes (as discussed below) the redundant check for request/reply and also changes some printf("%s", string) -> printf(string).

I'd be happy to get comments on it, especially if it breaks something.
It would be great if it could make its way to 0.99.7, but I'll understand if it'll misses it.

TIA,
Y.

On Nov 5, 2007 9:15 AM, Kaul <mykaul@xxxxxxxxx> wrote:
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.c.diff
Description: Binary data

  • Follow-Ups:
    • Re: [Wireshark-dev] Small performance improvements to packet-http.c
      • From: Alexey Neyman
    • Re: [Wireshark-dev] Small performance improvements to packet-http.c
      • From: Andreas Fink
  • References:
    • [Wireshark-dev] Small performance improvements to packet-http.c
      • From: Kaul
  • Prev by Date: [Wireshark-dev] why there is no frame check sequence field in ethernet frame
  • Next by Date: Re: [Wireshark-dev] Small performance improvements to packet-http.c
  • Previous by thread: [Wireshark-dev] Small performance improvements to packet-http.c
  • Next by thread: Re: [Wireshark-dev] Small performance improvements to packet-http.c
  • Index(es):
    • Date
    • Thread

Wireshark and the "fin" logo are registered trademarks of the Wireshark Foundation