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 X-Google-Thread: 103376,123c40d62c632159 X-Google-Attributes: gid103376,public From: lutz@iks-jena.de (Lutz Donnerhacke) Subject: Re: Stack based allocation vs. Dynamic allocation Date: 2000/05/31 Message-ID: #1/1 X-Deja-AN: 629407894 Distribution: world Content-Transfer-Encoding: 8bit References: Content-Type: text/plain; charset=iso-8859-1 Organization: IKS GmbH Jena Mime-Version: 1.0 User-Agent: slrn/0.9.5.7 (UNIX) Newsgroups: comp.lang.ada Date: 2000-05-31T00:00:00+00:00 List-Id: * Gisle S�lensminde wrote: >The stack program was 3 times faster if you consider user times. >In my tests the system time used was always at least 11 seconds, >while the stack program never used more than 0.05 seconds. The >system have to work harder when using heap allocation, which makes >the heap program run in only 1/4th of the time of the stack program. The heap management causes this performance gap. >The timing will be different on other platforms, but it would surprise >me if heap allocation is faster anywhere. With more realistic >memory usage, the heap allocation will probably be even worse. >The only exception is probably the JVM target, where nearly everything >is on the heap. There are a lot of 'single-address-space' OS around which do not have these limitations. There heap allocation might be much faster than stack allocation, simply because they have nothing to do on heap allocation but to change the parameters of the stack and often rearrange it otherwise.