Re: [xml] libxml2 performance



On Thu, May 30, 2002 at 11:41:31AM +0200, Peter Jacobi wrote:
Content-Description: Mail message body
Hi Daniel, All,

This may be a futile exercise in micro-optimization,
but given over 7% time attributed to isolat1ToUTF8
I've tried to improve that routine.

xmllint --noout --timing --repeat doc/libxml2-api.xml
[...]
  7.71      1.58     0.32    12400    25.81    25.81  isolat1ToUTF8
[...]


The attached patch introduces a fast path for plain ASCII
characters in the isolat1 input (up to 40% faster) with no
penalty (even slightly faster) for all input chars in the upper
half (and reasonable linear scaling between the extremes).
It's the fastest I can get when not allowed to be slower on
any input.

Of course, for such small routines you are at the mercy
of your compiler anyway, so it's not that clear what gcc
and others will make of it.

  thanks, applied, but it seems to not change much:

before (yesterday's run):

xmllint --noout --timing --repeat doc/libxml2-api.xml

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total
 time   seconds   seconds    calls  us/call  us/call  name
 22.65      0.94     0.94  1167400     0.81     1.39  xmlParseAttValue
  7.71      1.26     0.32 18745300     0.02     0.02  xmlCurrentChar
  7.71      1.58     0.32    12400    25.81    25.81  isolat1ToUTF8
  5.78      1.82     0.24  3570200     0.07     0.07  xmlNextChar
  4.58      2.01     0.19  1167500     0.16     0.20  xmlFreeNodeList
  4.34      2.19     0.18   917400     0.20     0.44  xmlParseCharData
  3.86      2.35     0.16  5782622     0.03     0.03  xmlStrndup
  3.37      2.49     0.14  1167400     0.12     0.53  attribute
  2.89      2.61     0.12  1167400     0.10     0.10  xmlNewNsPropEatName
  2.89      2.73     0.12   675000     0.18     1.54  startElement

after:

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total
 time   seconds   seconds    calls  us/call  us/call  name
 23.50      1.10     1.10  1167400     0.94     1.55  xmlParseAttValue
  8.33      1.49     0.39 18745300     0.02     0.02  xmlCurrentChar
  6.84      1.81     0.32  1167500     0.27     0.32  xmlFreeNodeList
  6.84      2.13     0.32    12400    25.81    25.81  isolat1ToUTF8
  4.70      2.35     0.22   917400     0.24     0.48  xmlParseCharData
  4.49      2.56     0.21   675000     0.31     5.07  xmlParseStartTag
  3.63      2.73     0.17   675000     0.25     1.52  startElement
  3.42      2.89     0.16  5782622     0.03     0.03  xmlStrndup
  3.21      3.04     0.15  1167400     0.13     0.23  xmlStringGetNodeList
  2.78      3.17     0.13  1349900     0.10     0.10  xmlSearchNs
  
 I'm surprized by the overall changes, well maybe I can't trust gprof much ...

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]