only dupe check when needed

Only enable datum dupe checking in collection after data
has been received.  This works under the assumption that a
single telemetry request will not contain duplicate elements,
thus, it is not necessary to check for dupes on the initial
request.

Improves performance when rows are sorted by a column
that has duplicate row-values.
This commit is contained in:
Pete Richards 2017-04-21 11:35:11 -07:00 committed by Victor Woeltjen
parent 284dec4903
commit 2d352ac574
2 changed files with 4 additions and 1 deletions

View File

@ -32,6 +32,7 @@ define(
*/
function TelemetryCollection() {
EventEmitter.call(this, arguments);
this.dupeCheck = false;
this.telemetry = [];
this.highBuffer = [];
this.sortField = undefined;
@ -161,7 +162,7 @@ define(
var startIx = _.sortedIndex(array, item, this.sortField);
var endIx;
if (startIx !== array.length) {
if (this.dupeCheck && startIx !== array.length) {
endIx = _.sortedLastIndex(array, item, this.sortField);
// Create an array of potential dupes, based on having the

View File

@ -292,6 +292,7 @@ define(
*/
function finishProcessing() {
telemetryCollection.add(rowData);
telemetryCollection.dupeCheck = true;
scope.rows = telemetryCollection.telemetry;
scope.loading = false;
@ -377,6 +378,7 @@ define(
function newData(domainObject, datum) {
limitEvaluator = telemetryApi.limitEvaluator(domainObject);
added = telemetryCollection.add([table.getRowValues(limitEvaluator, datum)]);
this.telemetry.dupeCheck = true;
}
objects.forEach(function (object) {