Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
20 Days of Clojure - Day 7: PersistentVector
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Lou Franco  
View profile  
 More options Mar 7 2008, 2:02 pm
From: "Lou Franco" <loumfra...@gmail.com>
Date: Fri, 7 Mar 2008 14:02:02 -0500
Local: Fri, Mar 7 2008 2:02 pm
Subject: 20 Days of Clojure - Day 7: PersistentVector

I've been doing 20 days of clojure on my blog.  Today's describes the
internals of PersistentVector objects.  If anyone sees errors in the
description, please let me know.

http://loufranco.com/blog/files/20-Days-of-Clojure-Day-7.html

--
Lou Franco
lfra...@greenwave-solutions.com


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rich Hickey  
View profile  
 More options Mar 7 2008, 3:07 pm
From: Rich Hickey <richhic...@gmail.com>
Date: Fri, 7 Mar 2008 12:07:26 -0800 (PST)
Local: Fri, Mar 7 2008 3:07 pm
Subject: Re: 20 Days of Clojure - Day 7: PersistentVector

On Mar 7, 2:02 pm, "Lou Franco" <loumfra...@gmail.com> wrote:

> I've been doing 20 days of clojure on my blog.  Today's describes the
> internals of PersistentVector objects.  If anyone sees errors in the
> description, please let me know.

I've been enjoying the series Lou, thanks.

I think where you say:

(def v2 (assoc v1 4))

you intended:

(def v2 (assoc v1 1 4))

I think the comparison to Okasaki's is tenuous - he's going for the
interface of list with better-than-linear random lookup performance,
while I'm going for near-O(1) performance for all operations.

Your point about the resulting vectors being immutable is spot on -
that's the key to multithreading. An interesting point of comparison
with purely-functional solutions such as that which Okasaki writes
about is that the Clojure vector can be log32N specifically because I
can use mutation - when cloning - , i.e. the tree is log32N deep and a
node can be copied in O(1) time due to arraycopy + indexed array set.
And yes, the vectors are optimized for lookup - in practice, log32N
blows logN out of the water.

Looking forward to more (leave me something to talk about on the
20th :)

Rich


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rich Hickey  
View profile  
(2 users)  More options Mar 8 2008, 6:44 pm
From: Rich Hickey <richhic...@gmail.com>
Date: Sat, 8 Mar 2008 15:44:06 -0800 (PST)
Local: Sat, Mar 8 2008 6:44 pm
Subject: Re: 20 Days of Clojure - Day 7: PersistentVector

On Mar 7, 3:07 pm, Rich Hickey <richhic...@gmail.com> wrote:

> On Mar 7, 2:02 pm, "Lou Franco" <loumfra...@gmail.com> wrote:

> > I've been doing 20 days of clojure on my blog.  Today's describes the
> > internals of PersistentVector objects.  If anyone sees errors in the
> > description, please let me know.

> I've been enjoying the series Lou, thanks.
> I think the comparison to Okasaki's is tenuous - he's going for the
> interface of list with better-than-linear random lookup performance,
> while I'm going for near-O(1) performance for all operations.

I re-read Okasaki's paper yesterday and woke up today with an idea for
speeding up the Clojure vector conj and pop. They are now 2-5x faster
than they were. The trick is to keep the tail of the vector out of the
tree until it is a full (32-element) node. Note that this greatly
speeds up vector construction, which typically consists of repeatedly
conj'ing onto [].

Make sure you check out Lou's latest entry, where he delves into the
details of PersistentHashMap:

http://loufranco.com/blog/files/20-Days-of-Clojure-Day-8.html

Rich


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google