I see what your meaning however...
Using a list window has overheads likely to do with the selectability functions of a list window, even more so if your sorting the list.
It would have been better to use a plain window in your example, also using -hlS does not work as the -l alone makes the main window area the listbox whcih means u would have needed the -s option to sort it, i however assumed you had ment this rather than the -S.
Heres a small alias and the results i got using it on different window types.
alias test {
window -c @test | window $1 @test
var %i = 1100000, %ticks = $ticks
while (%i > 1000000) { aline @test line %i | dec %i }
echo -s Using " /window $1 " took $calc($ticks - %ticks) ticks.
window -c @test
}
Using " /window -h " took 5078 ticks.
result unsorted Using " /window -hs " took 5110 ticks.
Using " /window -hl " took 10828 ticks.
result unsorted Using " /window -hls " took 73547 ticks.
As you can see a main text window if sorted or not takes near the same time
A listbox took twice the time while unsorted and over 12 times the time when sorted
From what i gather if you are sorting a window it is likely sorted to a memory buffer before being output to its destination.
I expect that this well make it faster than having to construct a hidden window and write to it letting it sort and then savebuf it to a file.