help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Performance optimization (allocation inside a for loop)


From: Andreas Romeyke
Subject: Re: Performance optimization (allocation inside a for loop)
Date: Thu, 2 Apr 2009 08:11:25 +0200

Hello,

Am Thu, 2 Apr 2009 00:18:28 +0100
schrieb r <address@hidden>:

> A common strategy is to allocate a bit more space than currently
> needed, so that malloc/realloc doesn't need to be called every single
> time the user appends data to the structure. Even better, this margin
> can be made dependent on the current structure size (e.g. proportional
> to n or to log(n)). This second scheme results in better
> performance/memory occupation ratio.

You are right, BUT octave handles with really big amounts of data. A
pre-allocation of data is not helpful in this cases.

> I'm (now) perfectly OK with preallocating memory manually, but it took
> me a lot of time to figure out where the bottleneck is. BTW, low "for"
> loop performance is commonly blamed on the lack of a JIT compiler, but
> I wouldn't be surprised if at least some of the test cases were
> actually suffering from issues like memory allocation. After all, JIT
> compilers don't typically speed up evaluation by more than a constant

The better way is to improve the tools to support the developers and
users to find bottlenecks, to suggest good practises and to develop an
JIT-compiler.

my 2 cents...

Bye Andreas
-- 
Software Developer / Dipl. Inform. (FH)
Max Planck Institute for Human Cognitive and Brain Sciences
Department of Psychology
Stephanstr. 1a, 04103 Leipzig, Germany

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]