On Sat, Feb 12, 2011 at 4:16 AM, Marko Topolnik <marko.topol...@gmail.com> wrote: >> > Just guessing, but is it something to do with this (from the docstring >> > of parse-seq)? >> >> > "it will be run in a separate thread and be allowed to get >> > ahead by queue-size items, which defaults to maxint". > > As I've figured it out, when there's XPP on the classpath, and I'm > using it, the code that does the parsing is entirely different and > does not involve a separate thread (see with_pull.clj). The parser > sits and waits for events to be requested from the lazy seq.
Yes, XPP is superior to SAX, especially for this sort of laziness. >> Finally, you might want to be able to walk an XML document larger >> than would fit in memory. I'm not sure if lazy-xml has ever been >> able to do this as it would need to be vigilant about not >> retaining the root of the returned document tree. > > I was under the impression that if the client was careful to lose the > nodes' parents, they would be free for garbage collection, as well as > previous siblings. The point is to first navigate to the > desired :content lazy seq and then lose all other refs. Then you are > in the same position as with any old lazy seq -- you run through it > without retaining the head, and things are good. It may work, but wasn't a design goal when I was originally writing lazy-xml, so it's possible I have stray head- or root-holding in the code. The problem you're observing is because of my use of drop-last, which forces the parsing of one extra sibling at *each* level of the tree. In your test case, this is a *lot* of extra parsing at exactly the point where you don't want it. The drop-last is used because the last node of each interior sequence holds the non-descendant events and so must be dropped from the content seq. I'm currently trying to come up with a different way of passing around the non-descendant events so that drop-last isn't necessary, but it's ...tricky, at least for my poor fuzzy brain. --Chouser http://joyofclojure.com/ -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en