[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #60928] Performance of sort unexpectedly slow
From: |
Michael Leitner |
Subject: |
[Octave-bug-tracker] [bug #60928] Performance of sort unexpectedly slow for DIM=2 |
Date: |
Mon, 16 Aug 2021 16:39:29 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:60.0) Gecko/20100101 Firefox/60.0 |
Follow-up Comment #16, bug #60928 (project octave):
Well done. I would think that the purpose of the code would perhaps be still
more obvious if the for-loop over j would be written as two loops, the inner
(j1) counting up to stride, the outer (j2) counting up to
dv.numel()/(ns*stride), and forming offset just as offset=j1+j2*ns*stride. Or
rather incrementing j2 by ns*stride, going up to dv.numel(), and having
offset=j1+j2.
Disregarding that, you could try whether it is even worth it having the
special case for stride==1. According to your timing data, sorting along the
first dimension with the special-case code is about 10% faster than for the
other dimensions (no special case). It is quite plausible that also for the
non-optimized path sorting along the first dimension is fastest, so if the
special case gives in the end only, say, 3% added efficiency, it is
questionable whether it is worth the complication. The difference is that in
the non special case, the data are copied from the in-array into a buffer,
sorted there, and copied into the out-array, while in the special case they
are directly copied into the out-array and sorted there.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?60928>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #60928] Performance of sort unexpectedly slow for DIM=2, Rik, 2021/08/14
- [Octave-bug-tracker] [bug #60928] Performance of sort unexpectedly slow for DIM=2, Rik, 2021/08/14
- [Octave-bug-tracker] [bug #60928] Performance of sort unexpectedly slow for DIM=2, Michael Leitner, 2021/08/15
- [Octave-bug-tracker] [bug #60928] Performance of sort unexpectedly slow for DIM=2, Michael Leitner, 2021/08/15
- [Octave-bug-tracker] [bug #60928] Performance of sort unexpectedly slow for DIM=2, Rik, 2021/08/16
- [Octave-bug-tracker] [bug #60928] Performance of sort unexpectedly slow for DIM=2, Rik, 2021/08/16
- [Octave-bug-tracker] [bug #60928] Performance of sort unexpectedly slow for DIM=2, Rik, 2021/08/16
- [Octave-bug-tracker] [bug #60928] Performance of sort unexpectedly slow for DIM=2, Rik, 2021/08/16
- [Octave-bug-tracker] [bug #60928] Performance of sort unexpectedly slow for DIM=2, anonymous, 2021/08/16
- [Octave-bug-tracker] [bug #60928] Performance of sort unexpectedly slow for DIM=2,
Michael Leitner <=
- [Octave-bug-tracker] [bug #60928] Performance of sort unexpectedly slow for DIM=2, anonymous, 2021/08/16
- [Octave-bug-tracker] [bug #60928] Performance of sort unexpectedly slow for DIM=2, anonymous, 2021/08/16
- [Octave-bug-tracker] [bug #60928] Performance of sort unexpectedly slow for DIM=2, Rik, 2021/08/16
- [Octave-bug-tracker] [bug #60928] Performance of sort unexpectedly slow for DIM=2, anonymous, 2021/08/16
- [Octave-bug-tracker] [bug #60928] Performance of sort unexpectedly slow for DIM=2, Rik, 2021/08/17
- [Octave-bug-tracker] [bug #60928] Performance of sort unexpectedly slow for DIM=2, Rik, 2021/08/17