https://bz.apache.org/bugzilla/show_bug.cgi?id=58221

--- Comment #2 from Javen O'Neal <[email protected]> ---
shiftRows is relatively expensive because it has to shift values, styles,
conditional formatting, references, merged ranges, formulas, etc. Doing this
n*log(n) or n² times is extremely expensive. It might be better to use a
sorting algorithm that makes minimal moves [1], or copy the cell values into an
array, sort the array and calculate the row offsets, shift each row by the row
offsets.

The Stack example below looks like a bubble sort. If you get yoyr example
working and discover that sorting speed is an issue, you might be able to get
better speed if you had access to POI's internals by adding a sortRows method
to POI. This could reduce the amount of recalculating merged ranges, formulas,
and references.

[1] Cycle sort, theoretically minimal number of writes
https://en.wikipedia.org/wiki/Cycle_sort

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to