English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
practical functional programming
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-11-06 (22:23)
From: Chris Hecker <checker@d...>
Subject: Re: practical functional programming

>This is a very silly example  but there are many real situations where
>persistence is needed  (I encountered many of them  in practice).

That may be a silly example, but it makes a lot of sense to me and I could see making use of that property.

I guess my next question then would be related to efficiency: isn't there a lot of copying going on if you've got to make a new instance of your symbol table just to add an element?  How does this work out in practice?

Again, I'm not saying efficiency is the only metric for software, but it does concern me when I see a large datastructure copied.  Is there some sort of reference counted sharing going on, or are there actually two copies of the data in memory if you wrote your example in caml?

I guess my hope would be that in the case where you didn't reference the old datastructure ever again you would get performance close to the equivalent imperative datastructure.  In the case where you did reference both old and new you'd get performance similar to writing an "undo-able" imperative datastructure from scratch, possibly with an optimization for not accessing the old datastructure until the new one had been undone (like in your example, and I would assume that's the common case for using persistence).