On Fri, Feb 11, 2011 at 2:35 PM, Chris Perkins <chrisperkin...@gmail.com> wrote: > On Feb 11, 5:07 am, Marko Topolnik <marko.topol...@gmail.com> wrote: >> http://db.tt/iqTo1Q4 >> >> This is a sample XML file with 1000 records -- enough to notice a >> significant delay when evaluating the code from the original post. >> >> Chouser, could you spare a second here? I've been looking and looking >> at mktree and siblings for two days now and can't for the life of me >> find out why it would eagerly parse the whole contents of an element >> as soon as I acces its struct! The code looks perfectly correct.
I can reproduce the behavior you describe. I'll look into it. > 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". > > Doesn't sound like it's actually lazy unless you explicitly specify a > queue-size. There's a few different reasons someone might want "lazy". You might want to be able to start examining the tree before it's done being parsed -- this is the default behavior of lazy-xml. Your code will block if it catches up with the parser, but shouldn't block earlier than it has to. Having the parsing thread do no work more than necessary (queue size 1) is another possibly desired behavior -- sounds like the OP's desire in which case the queue size does need to be specified. 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. --Chouser -- 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