Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!69.16.185.11.MISMATCH!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe08.iad.POSTED!8ad76e89!not-for-mail From: Arved Sandstrom User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.23) Gecko/20110922 Lightning/1.0b2 Thunderbird/3.1.15 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: Immutable Datastructures with good Sharing References: <4eb59a7e$0$292$14726298@news.sunsite.dk> <4eb59ed8$0$288$14726298@news.sunsite.dk> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Lines: 36 Message-ID: X-Complaints-To: abuse@newsgroups-download.com NNTP-Posting-Date: Sun, 06 Nov 2011 01:13:51 UTC Organization: Public Usenet Newsgroup Access Date: Sat, 05 Nov 2011 22:13:49 -0300 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9633 On 11-11-05 09:20 PM, markspace wrote: > On 11/5/2011 1:41 PM, Jan Burse wrote: >> Arne Vajhøj schrieb: >>> >>> How do you know that the clone solution use more CPU than >>> the solution you are looking for now?? >> >> It has been proven for the stack. > > > I'd like to see that proof. I think this is the fundamental disconnect > most people are having on this thread. What is an immutable stack > actually good for? There's nothing that comes to my mind. Concurrency. Immutable data structures help in that environment - nothing special about stacks in that regard. >> But a friend of mine implemented the same application, >> and he has a different solution for the queue and >> is orders of magnitude faster. > > Cloning or copying has got to be slow. I'd bet this is why your > solution is slow, even if you don't realize it. > If you are actually really cloning, or copying everything. If you are looking to implement efficient persistent data structures then the only bits you copy are the modified bits. The unmodified bits are shared, and are still immutable. AHS -- You should know the problem before you try to solve it. Example: When my son was three he cried about a problem with his hand. I kissed it several times and asked him about the problem. He peed on his hand. -- Radia Perlman, inventor of spanning tree protocol