Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] master b6d20a2: Optimize reseting epan_d
From: Jakub Zawadzki <[email protected]>
Date: Sat, 21 Jun 2014 22:12:48 +0200
Hi Evan,

On Thu, Jun 19, 2014 at 04:40:06PM -0700, Evan Huus wrote:
> On Thu, Jun 19, 2014 at 4:33 PM, Wireshark code review <[email protected]> wrote:
> 
> > URL:
> > https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=b6d20a27a149c1b09f17561f972d0f45a41de992
> > Submitter: Anders Broman ([email protected])
> > Changed: branch: master
> > Repository: wireshark
> >
> > Commits:
> >
> > b6d20a2 by Jakub Zawadzki ([email protected]):
> >
> >     Optimize reseting epan_dissect_t when filtering.
> >
> >     Don't destroy interesting_hfids hash table, just remove all values.
> >
> > [cut]
>
> Another possible improvement, rather than g_mallocing the elements in the
> hash table, we could put them in the pinfo pool, which is always freed when
> proto_tree_reset or proto_tree_free are called...

Sure, we can do it, but it looks for me < 1%.

18,116,612,393  PROGRAM TOTALS

wmem might reduce *a little* this 93M Ir below:

   266,173,051  *  ???:proto_tree_add_node [/tmp/wireshark/epan/.libs/libwireshark.so.0.0.0]
    63,201,727  >   ???:g_ptr_array_add (291740x) [/usr/lib64/libglib-2.0.so.0.3600.4]
    30,049,112  >   ???:g_ptr_array_new (291740x) [/usr/lib64/libglib-2.0.so.0.3600.4]

+ we will get rid of 74M Ir.

    79,962,317  *  ???:free_GPtrArray_value [/tmp/wireshark/epan/.libs/libwireshark.so.0.0.0]
    74,419,257  >   ???:g_ptr_array_free (291740x) [/usr/lib64/libglib-2.0.so.0.3600.4]

For now I'm not optimizating anything which gives < 1%, but I think Anders will be grateful for any optimizations.


If we're in topic of optimizing 'slower' [de]allocations in common functions:

- tvb allocation/deallocation (2.5%, or 3.4% when no filtering)

   243,931,671  *  ???:tvb_new [/tmp/wireshark/epan/.libs/libwireshark.so.0.0.0]
   202,052,290  >   ???:g_slice_alloc (2463493x) [/usr/lib64/libglib-2.0.so.0.3600.4]

   291,765,126  *  ???:tvb_free_chain [/tmp/wireshark/epan/.libs/libwireshark.so.0.0.0]
   256,390,635  >   ???:g_slice_free1 (2435843x) [/usr/lib64/libglib-2.0.so.0.3600.4]

- pinfo->proto_data, fd->pfd (~0.7%, or 1.2% when no filtering)

   194,007,044  *  ???:p_add_proto_data [/tmp/wireshark/epan/.libs/libwireshark.so.0.0.0]
   122,865,401  >   ???:g_slist_insert_sorted (893907x) [/usr/lib64/libglib-2.0.so.0.3600.4] [more than 50% in slice allocator]

   739,310,064  *  ???:epan_dissect_reset [/tmp/wireshark/epan/.libs/libwireshark.so.0.0.0]
    68,198,431  >   ???:g_slist_free (583479x) [/usr/lib64/libglib-2.0.so.0.3600.4]

    24,222,093  *  ???:frame_data_destroy [/tmp/wireshark/epan/.libs/libwireshark.so.0.0.0]
    21,616,060  >   ???:g_slist_free (187951x) [/usr/lib64/libglib-2.0.so.0.3600.4]


This, or next week I'll try to do tvb.


Cheers,
Jakub.