[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
permute optimization
From: |
John W. Eaton |
Subject: |
permute optimization |
Date: |
Tue, 27 Jan 2009 21:28:41 -0500 |
On 16-Dec-2008, Jaroslav Hajek wrote:
| using a similar technique as for dense indexing, I've rewritten
| permute, using a recursive, possibly parallelizable algorithm.
| As usual, a simplistic benchmark follows (set n to suitable value):
| n = 80;
| a = ones (n, 2*n, 2*n, 2, 5);
| tic; b = permute (a, [1, 2, 3, 5, 4]); toc
| clear b
| tic; b = permute (a, [3, 4, 1, 2, 5]); toc
| clear b
| tic; b = permute (a, [4, 3, 1, 2, 5]); toc
|
|
| before patch:
|
| Elapsed time is 0.202561 seconds.
| Elapsed time is 0.290111 seconds.
| Elapsed time is 1.05752 seconds.
|
| after:
|
| Elapsed time is 0.10301 seconds.
| Elapsed time is 0.212579 seconds.
| Elapsed time is 0.299735 seconds.
|
| I.e. speed-up by 96.6%, 36.5%, 252.8% (measured as old time / new time - 1).
Thanks for working on this.
| there is a further optimization possible - a blocked generalized
| transpose analogous to David's transpose optimization. Given the
| relative importance of transpose vs. permute, I don't think it's
| necessary, but certainly possible.
I don't see it as a high priority. Of course, it is up to you whether
you would like to work on it.
Thanks,
jwe
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- permute optimization,
John W. Eaton <=