On Aug 17, 3:51 am, Christophe Grand <christo...@cgrand.net> wrote:
> On Sat, Aug 15, 2009 at 4:23 PM, Andy Fingerhut <
>
> andy_finger...@alum.wustl.edu> wrote:
> > Not to say this ought to be done, but would it be possible to have no
> > 'edit' field *at all* for persistent data structures (not even a null
> > reference), and only an edit field at the "root" data structure of a
> > transient (none of the children would have one, only the root), and
> > preserve O(1) transient/persistent! calls?
>
> The problem is when you have several calls to transient/persistent! You have
> to be able to tell transient nodes owned by the current transient processing
> from older transient nodes left in place by previous calls to persistent!.
> (and these transient nodes can be shared!)
> One could have a set of nodes owned by the current transient but it would
> incur some bookkeeping to not retain a reference to a reclaimable node.
> I don't know if there's another way to do that.

But if there is only a single non-null edit reference in the "root
node", then the non-root nodes don't really need a reference to the
thread that is currently mutating the data structure, right?

And after a call to peristent!, a different thread could later call
transient on it, and want to make its own modified version.  So any
non-null edit references anywhere in the persistent data structure are
useless, aren't they?

>
> But even if edit remains in all of them, I'm wondering whether it
>
> > could be maintained that only the root node has a non-null edit field,
> > while that data structure is transient.
>
> Why do you focus on these AtomicReferences? If you contrast pre-transient
> vectors and actual vectors you'll see that the overhead due to instance of
> PersistentVector$Node is far more important.
>
> Christophe

I only focus my questions on AtomicReferences because I noticed them.
I haven't yet taken the time to read through all the source code
related to the implementation of transient data structures.

It just seems to me that a persistent data structure doesn't _need_ a
reference to the thread that created it.  It is now immutable, and it
and all of its "sub-parts" always will be, until and unless they are
deallocated by garbage collection.

Thanks,
Andy
--~--~---------~--~----~------------~-------~--~----~
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