[xml] Re: embedded libxml

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Sun Feb 06 2000 - 20:09:36 EST


On Sat, Jan 15, 2000 at 08:36:28AM -0500, Daniel Veillard wrote:
> On Fri, Jan 14, 2000 at 11:21:51AM -0800, Gregory Babior wrote:
> > My current goal is to create a version of libxml that
> > is as small as possible so it can run in an embedded
> > system [...]
> > studying the code base I've found there are some compile time
> > options that could be added to improve the modularization
> > of the code and allow the ability to significantly shrink
> > the code size. The options I have in mind (so far) are:
> >
> > 1) An option to use function calls rather than macros.
> > Because of your consistent use of, for example, ctxt
> > in the NEXT macro, it's very easy to sub in a function
> > with minimal impact on the code - specifically
> >
> > void nextFunc(xmlParserCtxtPtr ctxt) { /* do stuff*/;}
> > #define NEXT nextFunc(ctxt)
>
> yep agree, I want first to do some profiling to estimate
> the inpact and gauge what should be the option by default.

  Being stuck in an airport, I have looked at this.
I agree that the NEXT() macro is:
  - used in a lot of places
  - rather big

So I demacroified it as suggested in the XML and HTML parsers

Results of NEXT() demacroification on the XML parser
  parse loop exec time size in bytes
before 9.66 124376
after 9.80 91320

  This is a significant size improvement for a very small
speed penalty.

Results of NEXT demacroification on the HTML parser
  parse loop exec time size in bytes
before 4.49 42800
after 4.63 38176

  So as a whole I think that the size/speed tradeoff is more than
interesting, so I will make that change in the code base accordingly.
It is interesting to note that this simple change reduced the code
size by the same amount than the FTP, HTTP and the XPath code cumuled
(36 KBytes).

  Thanks a lot for reporting this !

Daniel

-- 
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | Today's Bookmarks :
Tel : +33 476 615 257  | 655, avenue de l'Europe | Linux XML libxml WWW
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Gnome rpm2html rpmfind
 http://www.w3.org/People/all#veillard%40w3.org  | RPM badminton Kaffe
----
Message from the list xml@xmlsoft.org
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@xmlsoft.org


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Aug 02 2000 - 12:30:01 EDT