Wireshark-commits: [Wireshark-commits] master a452d16: Optimize epan_new/init_dissection
From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Tue, 1 Jul 2014 04:21:15 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=a452d16f2c27fc44a41f14d05acca8e94b1c71d8
Submitter: Anders Broman (a.broman58@xxxxxxxxx)
Changed: branch: master
Repository: wireshark

Commits:

a452d16 by Evan Huus (eapache@xxxxxxxxx):

    Optimize epan_new/init_dissection
    
    As Anders correctly pointed out in I7d8f84b2e, constantly resetting state will
    turn init_dissection into a bit of a hot path. Especially as we will already
    bear the overhead of switching files, we don't want to fall any further behind
    than we have to.
    
    This change includes three unrelated optimizations that reduce the cost of
    init_dissection by about 40% as measured by callgrind:
     - only initialize ares/ADNS if that preference is enabled (this of course only
       applies if you specify -n to tshark or otherwise disable the preference)
     - use memcpy instead of a loop in sigcomp UDVM init
     - use memcpy instead of a loop in bootp dissector
    
    The only remaining obvious hot spot in this path is reassembly_table_init since
    it is called by so many dissectors. Suggestions (perhaps to get rid of the
    GPtrArray) welcome.
    
    Oh, and one other change to use g_strerror instead of strerror as insisted
    upon by the API pre-commit hook.
    
    Change-Id: I18a74f2b64b25498116079bd4e7fc2b335c7703a
    Reviewed-on: https://code.wireshark.org/review/2738
    Reviewed-by: Anders Broman <a.broman58@xxxxxxxxx>
    

Actions performed:

    from  659d0ef   sip optimization: avoid calling tvb_get_guint8.
    adds  a452d16   Optimize epan_new/init_dissection


Summary of changes:
 epan/addr_resolv.c             |   48 ++++++++++++++++++++++------------------
 epan/dissectors/packet-bootp.c |    7 +-----
 epan/sigcomp_state_hdlr.c      |   29 ++++++++++++------------
 3 files changed, 41 insertions(+), 43 deletions(-)