[cxml-devel] CXML performance

David Lichteblau david at lichteblau.com
Thu Sep 4 15:06:15 UTC 2008


Hi,

Quoting Chaitanya Gupta (mail at chaitanyagupta.com):
> I tried using CXML to parse a slightly big (~1.2 MB) XML in ACL 8.0. I  
> am using the following form to parse it into a DOM:
>
> (cxml:parse xml (cxml-dom:make-dom-builder)) ; xml is a string
>
> Generally, it takes about 0.73-0.75 sec to parse on my machine.

I'd accept that for now.  You could try (cxml:parse xml nil) to see how
much time XML parsing itself takes (as opposed to DOM building).  I
don't really have a recommendation regarding speed improvements either
way though.

> What also happens is that, while the parser is running, it blocks all
> the other threads i.e. they become unresponsive. Any clues on why it
> can be happening? And how it can be fixed?

Sounds to me like an artifact of ACL's scheduling algorithm.

On my version of ACL, the variable mp:*default-process-quantum* defaults
to 2.  If I understand correctly, this is measured in seconds, so if you
just had a context switch before calling CXML:PARSE, which takes 0.75s
in your case, ACL won't even consider giving time to any other thread.

(In particular because you're parsing from a string, so cxml doesn't
spend any time blocking on input.  The situation with files already
buffered by the kernel might be similar though.)

You could try setting a lower process quantum if this bothers you.

> Also, ACL on OS X (and Linux) does not run any Lisp code while a foreign  
> call is being made (thus blocking all the other threads). Is there any  
> chance that CXML calls any foreign code?

No, I don't think so.


d.



More information about the cxml-devel mailing list