octave-maintainers
[Top][All Lists]
Advanced

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

Re: FYI: bsxfun optimized


From: Jaroslav Hajek
Subject: Re: FYI: bsxfun optimized
Date: Tue, 20 Oct 2009 12:10:36 +0200

On Tue, Oct 20, 2009 at 11:57 AM, Søren Hauberg <address@hidden> wrote:
> tir, 20 10 2009 kl. 11:13 +0200, skrev Jaroslav Hajek:
>> One further question that remains is whether to retain the old code,
>> or replace it with the spread-and-apply approach above.
>> The old code is more memory-efficient (it creates the result array and
>> then updates it), but apparently slower, sometimes significantly.
>> Opinions?
>
> Cool! I love these X-has-been-optimised mails :-)
>
> Would it be possible to test if the system has enough memory to use the
> spread-and-apply approach before hand? If so, then you could do
> spread-and-apply when the memory is available and fall back to the
> memory-efficient approach otherwise. the down-side is of course that
> this gives more code to maintain.
>
> Søren
>
>

That's an interesting idea; however, I have no idea how to check for
available memory, and I doubt there's a simple portable way. In fact I
think most systems, including Linux, hide the physical memory details
pretty well from applications. OTOH, it certainly is possible - cf.
GNOME system monitor...

In any case, I'll repeat my usual statement that if you're really
short of memory, Octave (or Matlab, for that matter) isn't a good
language to use at all, like probably any language that lacks a
pass-by-reference semantics (even though otherwise it's so cool
there's no mutable/immutable mess compared to, say, Python).

-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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