Ethereal-dev: [Ethereal-dev] compare_proto_id taking up 20% of Ethereal's time

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

From: Richard Sharpe <rsharpe@xxxxxxxxxxxxxxxxx>
Date: Sat, 15 Nov 2003 15:00:09 -0800 (PST)
Hi,

Well, compare_proto_id is taking up something like 20% of the time when 
Ethereal loads a capture file or scans a capture file, it seems.

However, compare_proto_id is very simple:

static gint
compare_proto_id(gconstpointer proto_arg, gconstpointer id_arg)
{
        const protocol_t *protocol = proto_arg;
        const int *id_ptr = id_arg;
                                                                                
        return (protocol->proto_id == *id_ptr) ? 0 : 1;
}

So, it has to be the number of times it is called. It is passed to 
g_list_find_custom as a function for doing comparisons. This is probably 
being kept as a simple linked list that is scanned linearly and maybe we 
need a hash or some better function.
 
Regards
-----
Richard Sharpe, rsharpe[at]ns.aus.com, rsharpe[at]samba.org, 
sharpe[at]ethereal.com, http://www.richardsharpe.com