Reputation: 12823
Does anyone know which algorithm is used internally on Vim when :sort
command is used?
Is the same algorithm used to sort 10 lines than the one used to sort 10000 lines?
Upvotes: 2
Views: 342
Reputation: 196781
When available, an external sort
program is used. The internal algorithm is undocumented.
edit
Well, "undocumented as in ":help :sort
doesn't explain how the internal algo works".
Upvotes: 0
Reputation: 172688
Vim is open source; why don't you just have a look yourself? It's easiest via the online Mercurial repository:
http://code.google.com/p/vim/source/browse/src/ex_cmds.c
Vim delegates the actual sorting to the qsort()
library function.
Upvotes: 4