Dramatically speed up items pane sorting (~65% reduction in sort time on a test library of 195 items)

(Moved redundant string manipulation out of the sort() callback. I put it there by mistake in r831 when namespacing all the XUL ids right before b2.r2.)
This commit is contained in:
Dan Stillman 2007-01-02 11:28:04 +00:00
parent b8321f13ea
commit aec015c039

View file

@ -513,6 +513,7 @@ Zotero.ItemTreeView.prototype.sort = function()
column = this._treebox.columns.getFirstColumn();
}
var order = column.element.getAttribute('sortDirection') == 'ascending';
var columnField = column.id.substring(13, column.id.length-7);
if(column.id == 'zotero-items-typeIcon-column')
{
@ -535,8 +536,8 @@ Zotero.ItemTreeView.prototype.sort = function()
{
function columnSort(a,b)
{
var fieldA = a.getField(column.id.substring(13, column.id.length-7));
var fieldB = b.getField(column.id.substring(13, column.id.length-7));
var fieldA = a.getField(columnField);
var fieldB = b.getField(columnField);
if(typeof fieldA == 'string')
{