Skip to content

Commit

Permalink
cache the results of the last TrackMetadata query, to speed up the co…
Browse files Browse the repository at this point in the history
…mmon case of back-to-back queries differing only by range
  • Loading branch information
rbuels committed May 17, 2012
1 parent 3a11fcf commit bb67735
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions js/Model/TrackMetaData.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,14 @@ dojo.declare( 'JBrowse.Model.TrackMetaData', null,
}
},this);

var results = this._doQuery( query );
var results;
var queryFingerprint = Util.objectFingerprint( query );
if( queryFingerprint == this.previousQueryFingerprint ) {
results = this.previousResults;
} else {
this.previousQueryFingerprint = queryFingerprint;
this.previousResults = results = this._doQuery( query );
}

// and finally, hand them to the finding callback
findCallback(results,keywordArgs);
Expand All @@ -379,7 +386,7 @@ dojo.declare( 'JBrowse.Model.TrackMetaData', null,
//
// * for each individual facet, get a set of tracks that
// matches its selected values. sort each set by the
// tracks' unique identifier.
// track's unique identifier.
// * while still need to go through all the items in the filtered sets:
// - if all the facets have the same track first in their sorted set:
// add it to the core result set.
Expand All @@ -389,7 +396,6 @@ dojo.declare( 'JBrowse.Model.TrackMetaData', null,
// 'leave-out' counts for the odd facet out. count it.
// - shift the lowest-labeled track off of whatever facets have it at the front


var results = []; // array of items that completely match the query

// construct the filtered sets (arrays of items) for each of
Expand Down

0 comments on commit bb67735

Please sign in to comment.