From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3ccb707f4c91a5f2 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Java vs Ada 95 (Was Re: Once again, Ada absent from DoD SBIR solicitation) Date: 1996/11/03 Message-ID: #1/1 X-Deja-AN: 194117742 references: <325BC3B3.41C6@hso.link.com> <55gkch$gg6@fozzie.sun3.iaf.nl> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-11-03T00:00:00+00:00 List-Id: In article <55gkch$gg6@fozzie.sun3.iaf.nl>, Geert Bosch wrote: >Robert A Duff (bobduff@world.std.com) wrote: >`` Note that in Ada, or any language with tasking, the reference count > updates have to do locking in general, which might be rather > expensive. '' > >It is possible to have implementations that do not need locking for >objects that are not aliased or allocated by an allocator (using new). I don't understand what you mean by that. I thought we were talking about unbounded strings, and similar packages, where you allocate stuff on the heap and use reference counting to know when to reclaim it. The stuff on the heap is, of course, aliased. >In the more general case a very simple spin-lock is enough and the >overhead should only be one memory-read when the object is not locked. >String objects are locked almost never and when they are locked they >are only locked for a short time. True, but we're talking about an implementation of unbounded strings where a simple string assignment is just a copy of a pointer. Adding locking, plus incr/decr of reference counts, is a substantial overhead for such a simple operation. If GC can eliminate that overhead, it may well be a performance win, despite the fact that there is also some GC-specific overhead. (And I've seen some papers giving measurements that agree with that suspicion.) - Bob