Re: [xml] RAW && NXT with strncmp()



On Thu, Oct 09, 2003 at 03:59:00PM -0400, Chris Anderson wrote:
On Mon, 2003-10-06 at 05:09, Daniel Veillard wrote:

On Wed, Oct 01, 2003 at 04:44:14PM +0300, Igor Izvarin wrote:
For my opinion this change will improve the code readability and
maintenance, will reduce the source code size and object code size.

  Well I can agree about code lisibility, for maintainance, I'm not
sure as those parts are unlikely to change. And for object code size
and speed this is actually a penalty.

  So I'm not sure I will actually keep that change.

I messed with how memcmp works, trying a couple of different things like
comparing shorts and integers instead of chars (x86 allows unaligned
access w/penalty).  All work slightly slower than just comparing chars. 
I believe the memcmp is slower because it moves the chars from immediate
operands to another memory reference.  How's this for a compromise, not
quite as pretty, but still somewhat readable:

!     if (memcmp(CUR_PTR, "<!DOCTYPE", 9) == 0)
  
---

!     if (CMP9(CUR_PTR, '<', '!', 'D', 'O', 'C', 'T', 'Y', 'P', 'E')) 

  Sounds a decent way to get back at the old code while improving the
readability, I will probably apply and test this once I'm done with
the error handling changes,

  thanks,

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]