octave-maintainers
[Top][All Lists]
Advanced

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

Re: strrep vs. regexprep


From: Rik
Subject: Re: strrep vs. regexprep
Date: Mon, 24 Oct 2011 09:49:19 -0700

On 10/23/2011 02:21 PM, address@hidden wrote:
> Q2: 
> There's ample room for improvement in various parts I wrote. But I need to
> know:
> which one is faster,  strrep  or  regexprep ?
> Both of these are needed in several places, but AFAICS regexprep is more
> versatile.
Philip,

strrep is much faster, approximately 20X faster, than regexprep.  At some
point it would be nice to investigate why using the PCRE library is so much
slower.  For now, however, try to keep everything using Octave's own
internal string functions such as strrep, strtok, strfind, strsplit, etc. 
I have updated nearly every function except strtok in the scripts/strings
directory over the last month.  They have all been tweaked for better
performance.  Also, in general things are faster when operating on 2-D
character arrays rather than cell array of strings.  One doesn't always
have a choice though.

--Rik


reply via email to

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