|
From: | Daniel J Sebald |
Subject: | Re: slow char({str}) |
Date: | Tue, 23 Jun 2009 22:31:25 -0500 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 |
Jaroslav Hajek wrote:
On Sun, Jun 21, 2009 at 7:33 PM, Ben Abbott<address@hidden> wrote:I noticed a substantial amount of time is needed to convert a cell string into a string octave:50> tic; char ({repmat("a", [1, 100000])}); toc Elapsed time is 11.9 seconds. but ... octave:51> tic; char ({repmat("a", [1, 100000])}{1}); toc Elapsed time is 0.001117 seconds. Can someone with skilled in c++ take a look? BenPlease check http://hg.savannah.gnu.org/hgweb/octave/rev/4ff6f8efdda2 also transplanted into 3.2.x. thanks
Very nice Jaroslav. Which of these changes is the speedup coming from? This hunk - elem (i, j) = s[i][j]; + elem (i, j) = si[j]; shouldn't have been too much as there is only a little extra computation in the indexing before the change. From the looks of all_strings, I'd guess this is the important change: - string_vector s = matrix(i).all_strings (); + const string_vector s = strvec_queue.front (); + strvec_queue.pop (); The member function ::all_strings() isn't used too often. Would it make sense to remove ::all_strings() and replace it's use with similar mods? Dan
[Prev in Thread] | Current Thread | [Next in Thread] |