From bug-octave-request at bevo dot che dot wisc dot edu Sat May 13 01:01:41 2000 Subject: strrep speedup From: "John W. Eaton" To: pkienzle at kienzle dot powernet dot co dot uk (Paul Kienzle) Cc: bug-octave at bevo dot che dot wisc dot edu Date: Sat, 13 May 2000 01:03:50 -0500 (CDT) On 12-May-2000, Paul Kienzle wrote: | To: bug-octave at bevo dot che dot wisc dot edu | Cc: pkienzle | Subject: strrep speedup | | Bug report for Octave 2.0.13 configured for i386-pc-linux-gnu | | Description: | ----------- | | speedups for strrep. Break-even by 3 replacements, hundreds of times | faster for many, many replacements. | | Repeat-By: | --------- | | octave> s=blanks(2000); t=time(); strrep(s," ", "y"); time()-t | ans = 0.027692 | octave> s=blanks(2000); t=time(); strrep_orig(s," ", "y"); time()-t | ans = 6.Fix I applied this patch with one additional change. I removed if (size(s,1) == 1) t = t'; endif in the section jump > 0. Otherwise, I see octave:18> strrep ("abbc", "bb", "X") ans = aXc octave:19> strrep ("abbc", "bb", "XX") ans = aXXc octave:20> strrep ("abbc", "bb", "XXX") t = abbc ans = a X X X c Can you please explain if the transpose is really needed for some other case? Thanks, jwe ----------------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.che.wisc.edu/octave/octave.html How to fund new projects: http://www.che.wisc.edu/octave/funding.html Subscription information: http://www.che.wisc.edu/octave/archive.html -----------------------------------------------------------------------