hashing optimizations

Andreas Ericsson ae at op5.se
Wed Jun 15 14:17:02 CEST 2005


Ahoy.

The attached patch provides proper hashing for Nagios and the cgi's.

The various functions are implemented in include/hash.h (so they can be 
properly inlined in the functions that use them).

Some minor changes were necessary to other files as well. Notably, I've 
hoisted the initialization of the hashtables to a function of its own to 
save a lot of conditionals (the add_*_to_hashlist are always called from 
an inner loop with tons of iterations).

I've also resized the hash-tables somewhat. Let me know if this turns 
into a memory hog.

Note that I haven't tested this patch yet (except buildtests ofcourse). 
I thought it would be prudent to have a few people compile this on 
different platforms first to find the easy-to-fix showstoppers with odd 
archs/platforms/compilers/whatever.

Heads up for performance tests in a bit. I'll run all tests with Nagios' 
default optimization levels and no arch-specific gcc options, as I 
suppose that's how the vast majority of people running nagios will use it.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: nagios-proper-hash.diff
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20050615/234ebde7/attachment.ksh>


More information about the Developers mailing list