std.xml: Why is it so slow? Is there anything else wrong with it?

Russel Winder russel at russel.org.uk
Sun Mar 13 01:11:05 PST 2011


On Sat, 2011-03-12 at 23:34 -0500, dsimcha wrote:
> There seems to be a consensus around here that Phobos needs a good XML 
> module, and that std.xml doesn't cut it, at least partly due to 
> performance issues.  I have no clue how to write a good XML module from 
> scratch.  It seems like noone else is taking up the project either. 

I just worry that creating a whole self-standing library is a waste of
time when wrapping libxml2 and libxslt gets a fast XML subsystem for
free.  This is the direction Python has gone. cf.  the lxml package to
replace ElementTree.  The elephant in the room is of course W3C DOM.
Everyone believes they have to have an implementation, but no-one then
uses it.

> This leads me to two questions:
> 
> 1.  Has anyone ever sat down and tried to figure out **why** std.xml is 
> so slow?  Seriously, if noone's bothered to profile it or read the code 
> carefully, then for all we know there might be some low hanging fruit 
> and it might be an afternoon of optimization away from being reasonably 
> fast.  Basically every experience I've ever had suggests that, if a 
> piece of code has not already been profiled and heavily optimized, at 
> least a 5-fold speedup can almost always be obtained just by optimizing 
> the low-hanging fruit.  (For example, see my recent pull request for the 
> D garbage collector.  BTW, if excessive allocations are a contributing 
> factor, then fixing the GC should help with XML, too.)
> 
> If the answer is no, this hasn't been done, please post some canned 
> benchmarks and maybe I'll take a crack at it.
> 
> 2.  What other major defects/design flaws, if any, does std.xml have?
> 
> In other words, how are we really so sure that we need to start from 
> scratch?

Excellent question.  Especially given the existence of libxml2 and
libxslt.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at russel.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20110313/94b3e2ca/attachment.pgp>


More information about the Digitalmars-d mailing list