[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: new strsplit function
From: |
Rik |
Subject: |
Re: new strsplit function |
Date: |
Sun, 31 Mar 2013 23:06:04 -0700 |
On 03/31/2013 05:38 PM, Ben Abbott wrote:
> Rik,
>
> I've pushed a changeset that includes a note in the NEWS file.
>
> http://hg.savannah.gnu.org/hgweb/octave/rev/1de4ec2a856d
>
> I have not run any benchmarks. If it is any help, the new version is based
> on regexp().
Ben,
Unfortunately regexp is slow compared to operations on native char types.
I did a quick benchmark and I do think this is likely to be an issue. The
strread function is now 30X slower.
Benchmark Code:
cd scripts/string
tic; A = textread ("strtok.m", "%s"); toc
New results:
1.502 +/- .004
Old results:
0.0455 +/- .0006
Slowdown = 1.502 / .0455 = 33
strtok.m is a small file, 7.2KB, so a largish real data file is going to
parse very slowly.
>
> If we are to add another script, perhaps cstrsplit() is a good names (we did
> that for strcat some time ago). Where "c" is for (c)onventional.
That would be a good idea.
Also, shouldn't the replacement of existing instances have been
strsplit (str, del, "collapsedelimiters", false)
rather than
strsplit (str, del, false)
???
I don't see that the Matlab function accepts a third argument--only
PROP/VALUE pairs.
Cheers,
Rik
- Re: new strsplit function,
Rik <=
- Re: new strsplit function, Ben Abbott, 2013/04/01
- Re: new strsplit function, Philip Nienhuis, 2013/04/01
- Re: new strsplit function, Ben Abbott, 2013/04/02
- Re: new strsplit function, Carnë Draug, 2013/04/02
- Re: new strsplit function, Ben Abbott, 2013/04/02
- Re: new strsplit function, Carnë Draug, 2013/04/02
- Re: new strsplit function, Ben Abbott, 2013/04/02
- Re: new strsplit function, John W. Eaton, 2013/04/02
- Re: new strsplit function, Ben Abbott, 2013/04/03
- Re: new strsplit function, Ben Abbott, 2013/04/20