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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,3f0365b3a22c7556 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Tue, 11 Oct 2005 16:44:04 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <434c2709$0$21298$626a54ce@news.free.fr> Subject: Re: Heap vs Stack allocation Date: Tue, 11 Oct 2005 16:47:48 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4952.2800 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4952.2800 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-EhwgIR0+PaE8FHCB0chm8Q5+CfXo6Db8u9G4Kfo9zZhWCFILtKhcnNqT/9bp6WJxu8iuUAu6kJ+Akkt!L0dS2Vtv/w2rewUdupllxtlt8YlPqYcwfvpwJ46XiRMqJVRebIDikxDglZlnnQqrmu5kKmnVgiUh!9h/acsJdOPT86g== X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:5554 Date: 2005-10-11T16:47:48-05:00 List-Id: "Lionel Draghi" wrote in message news:434c2709$0$21298$626a54ce@news.free.fr... > The paper "Java theory and practice: Urban performance legends, > revisited - Allocation is faster than you think, and getting faster" > (http://www-128.ibm.com/developerworks/java/library/j-jtp09275.html?ca=dgr-l nxw07JavaUrbanLegends) > explains (as far as I understand) how JVMs optimize "on-the-fly" memory > allocation to use stack instead of heap, by using "Escape Analysis". > > My feeling is that those writing JVMs are working hard to guess the data > lifetime and optimize memory allocation accordingly, because the > language is unable to express this data locality. > I think that Ada semantics open much more opportunity to use the stack > (or registers). > Am I right, or is this "Escape Analysis" something really powerful? I guess I would see these as somewhat Apples and Oranges; the JVM is an interpreter, and that opens a lot of possibilities that aren't every going to be possible for purely static analysis. Moreover, pretty much everything that can be done statically can also be done by pure analysis if you want to spend enough time. (For instance, you don't need strong type to produce good code, but it certainly makes the job a lot easier.) That said, I think the more information that the programmer can provide the compiler about what they're doing, the better code that can be generated. I'm still convinced that, given a big enough budget, an Ada compiler can produce faster and smaller programs than that for any of the other "contenders". But you'd need an Ada-specific optimizer to take full advantage of the information that Ada provides, and it's probably not cost effective to create those. In all honesty, that doesn't matter that much. That last 10% of speed or space probably doesn't matter in the vast majority of uses. (Which is probably the real point of the "urban legend" article) What does matter is a lot of issues that have nothing much to do with the compiler -- tools support, library support, and language capability. Randy.