On Tue, Feb 25, 2003 at 11:24:38PM +0100, Achim Gsell wrote:
On Monday 24 February 2003 13:03, Roberto Nibali wrote: You can also test & try the attached "macro.c" which uses a hash function generated with gperf. In my tests the binary search made the macro expansion (4 macros in the template) about 2.5 times faster and the hash function (and some other minor changes) about 3 times.
The real solution for further improvements would be to preprocess the template description and cache the results. A template is a sequence of: constant_string macro constant_string macro ... e.g. a single pass would be enough to convert the string to an internal format representing the sequence above, then a much faster algorithm could be used to format the results as no lookups would be needed. (macros could be stored as looked up macro ids) I plan something like this in syslog-ng 2, as the basic infrastructure is there, it would however be a bit more difficult for 1.5.x. -- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1