On Dec 2, 2003, at 4:55 AM, Tomas Kukosa wrote:
attached patch contains small TPKT performance improvement.
The find_protocol_by_id() was called for each packet and it took some
time
as this function performs linear serching in the protocols GList.
I've checked in a different change, which calls "find_protocol_by_id()"
when the protocol is registered and saves the "protocol_t *" that it
returns, and passes that to "proto_is_protocol_enabled()"; that mirrors
what's done for protocol handles.
If the overhead of calling "proto_is_protocol_enabled()" is
significant, it would be significant elsewhere as well, in which case
that should be fixed globally (e.g. by exporting the structure of a
"protocol_t" and having a "PROTO_IS_PROTOCOL_ENABLED()" macro to test
the enabled flag).
There are other dissectors that call "find_protocol_by_id()" when
dissecting; those should probably be changed as well.
At some point, we might also want to have "proto_register_protocol()"
take a "protocol_t **" argument and set the "protocol_t *" pointed to
by that argument to point to the new protocol's "protocol_t", and have
more routines take "protocol_t *"s rather than protocol IDs as
arguments; that might make startup run faster. (We might want to do a
profiled run of starting up Ethereal and exiting immediately.)