I can confirm that the same thing is happening on my end as well.  The
XML is parsed lazily:

user=> (time (let [root (parse-trim (reader "huge.xml"))] (->
root :content type)))
"Elapsed time: 45.57367 msecs"
clojure.lang.LazySeq

...but as soon as I try to do anything with the struct map for the
DataArea element (second element in root's content), the entire
element appears to be parsed eagerly.

user=> (time (let [root (parse-trim (reader "huge.xml"))] (->
root :content second type)))
"Elapsed time: 884.905205 msecs"
clojure.lang.PersistentStructMap

I spent some time looking at the source for lazy-xml as well, but
wasn't able to locate where the problem lies :(

On Feb 11, 3:07 am, Marko Topolnik <[email protected]> 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.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to