Nope, I have not sent in a CA yet.  I'll do it sometime this week.

Now that I think about it some more, though, this change doesn't
really address the whole problem.

; Time to queue up and dequeue a bunch of elements
user> (doseq [n '(10 100 1000 10000 100000)]
        (do (prn n)
            (time (loop [n n s [-1]]
                     (if (zero? n)
                          s
                       (recur (dec n) (subvec (conj s n) 1)))))))

10
"Elapsed time: 0.082 msecs"
100
"Elapsed time: 0.402 msecs"
1000
"Elapsed time: 27.426 msecs"
10000
"Elapsed time: 4167.749 msecs"
100000
; Stack Overflow

In particular, sequences of conjs and subvecs will remain quadratic,
and eventually lead to a stack overflow as seen here.  (Are there
other operations I should be using here?).

It would be really great if vectors could detect their nesting level
and periodically flatten themselves so that sequences of add and
subvec operations have amortized O(1) time (and use constant memory).
I'm not sure if that's even possible though; Clojure has been my first
real experience with immutable data structures.  Thoughts?

Cheers,
Jason


--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to