Re: [xml] RAW && NXT with strncmp()
- From: Steve Williams <swilliams rinax com>
- To: Igor Izvarin <iin rgdata ukrtel net>
- Cc: xml gnome org
- Subject: Re: [xml] RAW && NXT with strncmp()
- Date: Wed, 01 Oct 2003 09:55:53 -0600
Hi,
Depending on the frequency of a match NOT occuring, the original code
could be significantly faster. The first condition that did not match
causes the remaining comparisons to not happen. If in 90% of the cases
(I have no idea the context of this code), the match is going to fail on
the (RAW=='<'), then the other two comparisons would NOT happen.
This compared with the overhead of a function call every time... but
then I'm an "old school" C programmer who considers things like speed.
I'd be inclined to make a #define for the comparison if it occurs in so
many places. But that's just me...
Cheers,
Steve
Igor Izvarin wrote:
Hi community,
I think this is the question mainly to Daniel Veillard, but ... :-)))
I found 79 (more or less) places in the parser.c code that contains
fragments like this:
if ((RAW == '<') && (NXT(1) == '?') && (NXT(2) == 'x') && ....)
Its functionality is exact repetition of the functionality of the
strncmp() standard function.
if (strncmp(RAW, "<?x...", n) == 0) ...
This function can be expanded inline using the #pragma intrinsic(...)
instruction.
For my opinion this change will improve the code readability and
maintenance, will reduce the source code size and object code size.
What is your opinion on this?
With best regards,
Igor Izvarin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]