[mercury-users] XML Parsing (fwd)

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Jun 12 12:26:30 AEST 2001

On 08-Jun-2001, Thomas Conway <conway at cs.mu.OZ.AU> wrote:
> On Fri, Jun 08, 2001 at 11:48:18AM EST, Michael Day wrote:
> > >From what I can see, 40% of the time is being spent in
> > xml:parse:chars:baseChar/2, which makes it look like character
> > interpretation *is* the culprit after all. Comments from people who know
> > how to understand profiles would be nice.
> > 
> > (the program executed was tryit compiled with -O6 and mgnuc with -O2 run
> > on a largish XML file with namespaces)
> > 
> Well, I just examined the C code and it's not hard to see what the
> problem is.  The closure is not being constructed as a static ground
> term, so the C code is constructing that whole horrible thing for each
> character of input it tries to read.  I'm not certain, and I don't have
> time to look right now, but I'm pretty sure this is a bug in the compiler.

I had a look.  The reason that it needs to construct the closures dynamically
rather than statically is because they contain the type_info for the type `T1'.
(As it happens, I think this will probably not actually be used
unless debugging is enabled, but inferring this would require fairly
sophisticated intermodule analysis.)

So you might get a big speed-up by making the routines monomorphically typed
rather than polymorphically typed, or by using the user-guided type
specialization pragmas (see the "pragmas" chapter in the language reference

Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe

More information about the users mailing list