Boost logo

Boost :

From: Joel de Guzman (djowel_at_[hidden])
Date: 2002-10-24 19:31:01


----- Original Message -----
From: "Darryl Green" <green_at_[hidden]>

> > -----Original Message-----
> > From: Joel de Guzman [mailto:djowel_at_[hidden]]
> > Spirit is layered. It is header only and you pay only for
> > what you use. For small parsing tasks such as the date/time,
> > numbers, calculators, the code size is dominated by the
> > std::lib support, especially iostream. For example, CW
> > reports 25K code size and 7K data size for the comma
> > separated number list parser, this includes the vector and
> > iostream. The actual instantiated parser, is 5K code size and
> > 1.3K data
> > size (including the semantic action that stuffs the numbers
> > in the vector and the driver code that creates a scanner from
> > a std::string).
>
> I think that solves my immediate problem with regex (a simple parser for CGI
> params). On the other hand, one of my associates had a quick look at using
> the XML parser (same project) and the code size was an issue for us.
> Performance wasn't great either (both compared to hard-coded XML parsers
> like expat). I suspect we could have improved both though neither of us are
> parser experts and time was pressing... Please don't take this as a
> criticism of Spirit - it is very impressive, and we suspect it is the user,
> not the tool, at fault here, not to mention the fact that modifying expat
> isn't something I'd want to try, while modifying the Spirit XML parser was
> relatively easy.

How big is expat?

Dan Nuffer did some tests a couple of months ago with Spirit and libxml:

    I'm using gcc 3.0.3 with -O3 flag to compile.

    We have an example called simplexml.cpp which parses XML, but does no
    DTD validation. It's 212 lines long: 110 of that is to define the XML
    parser, and the rest is simple xml test snippets. When compiled and
    stripped, the executable is 102604 bytes.

    Now, take libxml 2.4.5. It's an XML parser written in C. The actual
    XML parser is in a file called parser.c, which is 10199 lines long!
    When compiled, the object file is 115516 bytes.

'fcourse, this is comparing apples to oranges ;)... and hey, the XML
parsers in the Spirit distribution are just demos. There are tons of
optimizations that can be done.

Regards,
--Joel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk