05-19-2005, 01:49 PM
I tested with winapiqm.txt, which is 379 kb. It took 4 seconds. Then I replaced str to lpstr, and then it took 100 ms. The slow part is converting string to array at the beginning. It must allocate and copy near 100000 strings. With lpstr, string allocation/copying is eliminated.
Macro:
Function sortlpstrproc:
Macro:
int t1=GetTickCount
str a.getfile("$qm$\winapiqm.txt")
ARRAY(lpstr) b
tok a b -1 "[]" 1
qsort &b[0] b.len sizeof(lpstr) &sortlpstrproc
str a2=b ;;don't use a, because strings in b actually are stored in a
int td=GetTickCount-t1
out td
;
ShowText "" a2
Function sortlpstrproc: