octave-maintainers
[Top][All Lists]
Advanced

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

Re: Speed up 'unique'


From: Daniel J Sebald
Subject: Re: Speed up 'unique'
Date: Thu, 18 Dec 2008 22:21:03 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020

Jaroslav Hajek wrote:


Always
program as efficiently as possible.  Basically, Octave/Matlab isn't too much
of a loss over C if done efficiently, but extaneous string tests really take
a hit.



Here, I think the main problem is that the strmatch function used to
parse the options is an m-function. Although Octave's library
m-functions bypass (by default) timestamp checks, calling an
m-function is significantly slower than calling a built-in or dld
function.

Yes.  One recent bottle neck I ran across is using "diff" to check for equal 
contiguous array elements.  Unique uses array indexing to achieve the same effect much 
faster.  I now use the latter approach.

Dan


reply via email to

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