[04 Dec 2008] Sort and locale

Contains all messages from the Hollywood mailing list between 01/2006 and 08/2012
Locked
User avatar
lazi
Posts: 627
Joined: Thu Feb 24, 2011 11:08 pm

[04 Dec 2008] Sort and locale

Post by lazi »

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? :-)
User avatar
lazi
Posts: 627
Joined: Thu Feb 24, 2011 11:08 pm

[04 Dec 2008] Re: Sort and locale

Post by lazi »

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 :)
User avatar
airsoftsoftwair
Posts: 5446
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[05 Dec 2008] Re: Sort and locale

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 05 Dec 2008 23:30:04 +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?
Bubble sort :-)
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.
Yes, this is planned.
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.
Hmm, you can pass tables to functions just as normal arguments e.g.

Code: Select all

Function p_TestFunc(t)
   DebugPrint(t[0], t[1])
EndFunction

p_TestFunc({16, 82})   ; prints 16 82
And one last question: Should I reserve from the Christmas money for a soon to be released new Hollywood upgrade? :-)
I won't probably make it before Christmas but we're getting closer :)
Locked