Mon 01 Jul 2013 05:15:42 PM UTC, original submission:
The patches will be attached as soon as I have the bug number for the commit messages.
Slowness of cell2mat:
The latter command produced signes of thrashing due to memory exhaustion (severe disk access, slowing down of other applications).
(Same for reversed dimensions:
)
Slowness is partially due to a call, during argument checking:
which is made although there is no specialized method "isnumeric" in cellfun.
The rest of slowness and the thrashing seem to be due to the
cellfun("cat", ...) calls, which are necessary for cell-arrays
containing non-scalar elements. The code strives to minimize the number of cat() calls (within cellfun() calls) but seemingly has the sort order of the dimensions mistaken, it should be descending (which was the intention also according to the comments in the code). After correcting this, there is no thrashing (or less?) and the function is faster:
and with reversed dimensions
The attached cell2mat changeset makes the above correction and
furthermore introduces a special case for scalar-only elements, where one single cat() call can be used. This special case shortens duration from (here already with the cellfun changeset (see below), so both are faster than before):
to
I'd suggest applying this changeset to the stable branch.
The attached cellfun changeset adds the "isnumeric" special case to cellfun. With this:
(was 30 s before, see above), which adds to the speed enhancement of cell2mat.
I'd suggest applying this changeset to the default branch.
Olaf
|