aboutsip / pkts

Pure java based pcap library capable of reading and writing to/from pcaps.
Other
196 stars 91 forks source link

Fast SIP header search #119

Closed nragon closed 4 years ago

nragon commented 4 years ago

Hi,

For fast header indexing on SIP message shouldn't we use, for instance, LinkedHashMap or simply HashMap, on ImmutableSipMessage? I have a use case where I only want some headers depending on user input.

Thanks, Nuno

jonbo372 commented 4 years ago

Feel free to run some performance tests to see if it truly matters. Based on my own performance tests, this is fast enough but if you have a use case where you always would access less common headers, that has their index saved, you may experience a different result.

Currently, it is optimized for the commonly used and mandatory headers so remember, if you change to another solution to optimize for some other random header, overall, you may make the solution slower because the stack itself, need to get all of those mandatory headers.

So, change it, run performance tests using sipp or something and see if it matters.

nragon commented 4 years ago

Thanks :) Will do.