Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 04 Dec 2008 00:54:21 +0100
Hello Andreas!
The story started when I wanted to play an animation while sorting a large text table.
I made a quicksort function and the result shocked me.
The same table which takes 4913 ms to sort by the Sort() function takes ~0 ms (zero) by the quicksort algorithm.
I know that optimization is behind functionality, but what could cause such a huge difference?
The problem is with all of the sort methods that I cannot sort accented characters correctly. It would be great to have a function that use locale.library/StrnCmp (on the Amiga, and whatever function on other systems) then I could use it in my quicksort function.
The second problem is that I couldn't figured out how can I pass a table to a function. I'd like to make a p_qsort(table,first,last) function to be useable generally. Currently I had to hardwire the table name in the function.
And one last question: Should I reserve from the Christmas money for a soon to be released new Hollywood upgrade?
[04 Dec 2008] Sort and locale
[04 Dec 2008] Re: Sort and locale
Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 04 Dec 2008 01:05:21 +0100
Hi!
It is a fast correction! Don't get serious the following in my last post because it is too late and something slipped out of my control
Hi!
It is a fast correction! Don't get serious the following in my last post because it is too late and something slipped out of my control
- airsoftsoftwair
- Posts: 5443
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
[05 Dec 2008] Re: Sort and locale
Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 05 Dec 2008 23:30:04 +0100
Bubble sortHello Andreas!
The story started when I wanted to play an animation while sorting a large text table.
I made a quicksort function and the result shocked me.
The same table which takes 4913 ms to sort by the Sort() function takes ~0 ms (zero) by the quicksort algorithm.
I know that optimization is behind functionality, but what could cause such a huge difference?
Yes, this is planned.The problem is with all of the sort methods that I cannot sort accented characters correctly. It would be great to have a function that use locale.library/StrnCmp (on the Amiga, and whatever function on other systems) then I could use it in my quicksort function.
Hmm, you can pass tables to functions just as normal arguments e.g.The second problem is that I couldn't figured out how can I pass a table to a function. I'd like to make a p_qsort(table,first,last) function to be useable generally. Currently I had to hardwire the table name in the function.
Code: Select all
Function p_TestFunc(t)
DebugPrint(t[0], t[1])
EndFunction
p_TestFunc({16, 82}) ; prints 16 82
I won't probably make it before Christmas but we're getting closerAnd one last question: Should I reserve from the Christmas money for a soon to be released new Hollywood upgrade?