I run profiling using firebug profile on:
var f1 = function (a, b) {return true;};
var f2 = function (a, b) {return f1(b, a);};

When I run 1000000 calls, I get stable performance penalty of:
* 350ms on Intel I7 920 using Mozilla/5.0 (X11; U; Linux x86_64;
en-GB; rv:1.9.1) Gecko/20090701 Gentoo Firefox/3.5
* 1600ms on Intel 2.8Ghz HT using Firefox 3.0 on ArchLinux

So far it seems that it makes sense to use f2() to sort small tables
below 1000-1500 rows in worst case scenarios.
Performance wise it's better to use predefined descending function.

I'll run tests using patch made by Derrell tomorrow.

---
Ian

2009/7/8 Derrell Lipman <[email protected]>:
> On Wed, Jul 8, 2009 at 10:21 AM, dmbaggett <[email protected]> wrote:
>>
>>
>> The argument given in the source for having two methods is "performance
>> reasons". But swapping parameters obviously causes no performance
>> degradation.
>
> Actually, I don't believe that's true. It imposes an extra function call for
> each two items that are compared. Depending upon the sort algorithm that's
> implemented in the native Array.sort() and how out-of-order the items are to
> begin with, this means a likely minimum number of extra function calls is
> the number of rows in the table, and the actual number could be much, much
> greater.
>>
>> For the new (to-be-named) enhanced table model which I recently submitted
>> as
>> an enhancement, this is a trivial change.
>>
>> The only question is whether we want to do anything to avoid breaking
>> existing code as this will constitute an API change.
>
> See my proposed implementation that handles this and associated comments in
> bug #2553:
>   http://bugzilla.qooxdoo.org/show_bug.cgi?id=2553
>
> Derrell
>
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to