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: [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: 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

  • Follow-Ups:
    • Re: [Wireshark-dev] Small performance improvements to packet-http.c
      • From: Kaul
    • Re: [Wireshark-dev] Small performance improvements to packet-http.c
      • From: Stephen Fisher
  • Prev by Date: [Wireshark-dev] More ITU-T standards available
  • Next by Date: Re: [Wireshark-dev] More ITU-T standards available
  • Previous by thread: Re: [Wireshark-dev] More ITU-T standards available
  • 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