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



On Thu, Oct 09, 2003 at 03:59:00PM -0400, Chris Anderson wrote:
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')) 

  Okay, this is better than the original solution, applied and commited,

    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]