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



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')) 

Attachment: parser.c.diff
Description: Text Data



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