Comparing version 1.1.0 to 1.1.1
@@ -0,1 +1,6 @@ | ||
v1.1.1 | ||
====== | ||
* Minor performance tweaks | ||
v1.1.0 | ||
@@ -2,0 +7,0 @@ ====== |
@@ -69,7 +69,8 @@ module.exports = PriorityQueue; | ||
PriorityQueue.prototype.add = function(key, priority) { | ||
if (!(key in this._keyIndices)) { | ||
var entry = {key: key, priority: priority}; | ||
var index = this._arr.length; | ||
this._keyIndices[key] = index; | ||
this._arr.push(entry); | ||
var keyIndices = this._keyIndices; | ||
if (!(key in keyIndices)) { | ||
var arr = this._arr; | ||
var index = arr.length; | ||
keyIndices[key] = index; | ||
arr.push({key: key, priority: priority}); | ||
this._decrease(index); | ||
@@ -130,3 +131,3 @@ return true; | ||
var parent; | ||
while (index > 0) { | ||
while (index !== 0) { | ||
parent = index >> 1; | ||
@@ -144,7 +145,8 @@ if (arr[parent].priority < priority) { | ||
var keyIndices = this._keyIndices; | ||
var tmp = arr[i]; | ||
arr[i] = arr[j]; | ||
arr[j] = tmp; | ||
keyIndices[arr[i].key] = i; | ||
keyIndices[arr[j].key] = j; | ||
var origArrI = arr[i]; | ||
var origArrJ = arr[j]; | ||
arr[i] = origArrJ; | ||
arr[j] = origArrI; | ||
keyIndices[origArrJ.key] = i; | ||
keyIndices[origArrI.key] = j; | ||
}; |
@@ -1,1 +0,1 @@ | ||
module.exports = '1.1.0'; | ||
module.exports = '1.1.1'; |
{ | ||
"name": "cp-data", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "cp-data is a JavaScript library for some common data structures", | ||
@@ -11,3 +11,3 @@ "main": "index.js", | ||
], | ||
"scripts": { | ||
"config": { | ||
"blanket": { | ||
@@ -24,3 +24,3 @@ "pattern": "lib", | ||
"blanket": "1.x.x", | ||
"browserify": "~2.33.1", | ||
"browserify": "~2.35.1", | ||
"chai": "1.7.x", | ||
@@ -45,1 +45,2 @@ "grunt": "~0.4.1", | ||
} | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18000
491