OK WOW. You hit the nail on the head. It's "reverse" being called in a pmap
that does it. When I redefine my own version of reverse (I totally cheated
and just stole this) like this:

(defn reverse-recursively [coll]
  (loop [[r & more :as all] (seq coll)
         acc '()]
    (if all
      (recur more (cons r acc))
      acc)))



I speed it up from, get this, 4:32 to 0:25. Yeah.

In case anybody's curious, pmap and pmapall show identical performance in
this case.

Wow.

-Josiah

On Tue, Dec 11, 2012 at 1:06 PM, Marshall Bockrath-Vandegrift <
llas...@gmail.com> wrote:

> Lee Spector <lspec...@hampshire.edu> writes:
>
> > If the application does lots of "list processing" but does so with a
> > mix of Clojure list and sequence manipulation functions, then one
> > would have to write private, list/cons-only versions of all of these
> > things? That is -- overstating it a bit, to be sure, but perhaps not
> > entirely unfairly -- re-implement Clojure's Lisp?
>
> I just did a quick look over clojure/core.clj, and `reverse` is the only
> function which stood out to me as hitting the most pathological case.
> Every other `conj` loop over a user-provided datastructure is `conj`ing
> into an explicit non-list/`Cons` type.
>
> So I think if you replace your calls to `reverse` and any `conj` loops
> you have in your own code, you should see a perfectly reasonable
> speedup.
>
> -Marshall
>
> --
> 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
>

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

Reply via email to