octave-maintainers
[Top][All Lists]
Advanced

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

faster octave_value constructor


From: Jaroslav Hajek
Subject: faster octave_value constructor
Date: Wed, 18 Mar 2009 06:49:06 +0100

Hi,

I noticed that the default octave_value constructor was always
allocating an empty octave_base_value.
I replaced that with an inline shared static null representation
constructor, like in Array.
http://hg.savannah.gnu.org/hgweb/octave/rev/d12f44a5dce3

This seems to have sped up constructing of octave_values significantly.
Trying the following:
tic; a = cell (1e7, 1); toc
tic; b = a(1:2:end,:); toc

I get with a recent tip

Elapsed time is 0.700683 seconds.
Elapsed time is 0.389235 seconds.

and with a current tip

Elapsed time is 0.090837 seconds.
Elapsed time is 0.0897031 seconds.

so it seems that the constructor was really a significant bottleneck.
Various manipulations of cell arrays should now be significantly
faster.
Since this was the default constructor, this will probably slightly
positively affect a lot of code.

cheers

-- 
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]