Ethereal-dev: Re: [ethereal-dev] Fun with performance

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: John McDermott <jjm@xxxxxxxxxx>
Date: Sat, 28 Aug 1999 16:43:21 -0600
I see no reason not to change the order if it improves performance. 
Unless I am reading the code incorrectly, the filter is indeed only
applied once.  What *is* done for each filter is the comparison with the
data (this may just be semantics).  I do not see any functional
difference if you do the change, though.

I just did a quick test and it looks fine.  The messages in colors.c
need to be changed to reflect the new processing of the list.  I should
probably get rid of the ifdef debuggery in file.c, as well.  I can take
care of it Monday, or if you feel inclined, Gilbert, you can do it. 
All  I did to test it was add a break:
Index: file.c
===================================================================
RCS file: /cvsroot/ethereal/file.c,v
retrieving revision 1.84
diff -C5 -r1.84 file.c
*** file.c	1999/08/28 01:51:57	1.84
--- file.c	1999/08/28 22:29:16
***************
*** 506,515 ****
--- 506,516 ----
  		 cf->pd)){
                  color = crow;
  #ifdef DEBUG_COLOR_FILTERS
                  fprintf(stderr,"yes\n");
  #endif
+ 	        break;
              }
  #ifdef DEBUG_COLOR_FILTERS
              else {
                  fprintf(stderr,"no\n") ;
                  fflush(stderr);


--john

Gilbert Ramirez wrote:
> 
> On Thu, Aug 26, 1999 at 04:19:33PM -0500, Jeff Jahr wrote:
> >
> >         On the subject of performance, I believe [1] that the color filter
> > code is set up to always try and apply each color filter in the list to
> > each packet being decoded.
> >
> >         Changing that function to 'the first matching color filter in list
> > is the one applied' from 'all matching color filters are applied in order'
> > would be good optimization with no loss of functionality...
> 
> Yes, that's true. John, would we lose any functionality if we stopped
> applying the color display filters when we first find a matching filter?
> It would mean that the user would have to sort his color filters in reverse
> order to how they are now. That is, any filters matching on a high-level
> protocol should come first, and filters matching on the lower layers should
> come last:
> 
>         FTP = red on white
>         TCP = blue on white
>         IP = white on read
>         TRMAC = white on blue
> 
> Would the colorization still provide what it provides now?
> 
> --gilbert

-- 
John McDermott jjm@xxxxxxxxxx
Writer and Computer Consultant
J-K International, Ltd.
+1 505/377-6293 - V
+1 505/377-6313 - F