Skip to content

Commit

Permalink
starting to restructure files
Browse files Browse the repository at this point in the history
  • Loading branch information
nickzuber committed Sep 17, 2016
1 parent 0ab4786 commit 4107719
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ node_modules
examples/scripts
*.json
*.md
LICENSE
LICENSE
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

## Coming soon<sup><sub>TM</sub></sup>
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

## Coming soon<sup><sub>TM</sub></sup>
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ node_modules
npm-debug.log
scripts/testing
scripts/build
.DS_Store

# Various Builds
build
build
4 changes: 2 additions & 2 deletions bin/needle.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/scripts/needle.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "src/needle.js",
"scripts": {
"build": "gulp",
"dev": "gulp watch",
"bench": "node --harmony benchmarks/runTests.js || true",
"unit": "node --harmony unit/runTests.js || true",
"lint": "./node_modules/.bin/eslint src/*.js || true",
Expand Down
8 changes: 8 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

## Performance Analysis (Coming soon<sup><sub>TM</sub></sup>)

Right now, performance benchmarks are done through taking the current time stamp before we execute a unit of code, and then taking the current time stamp once that code has finished executing. The performance is measured by the difference between those two time stamps.

In the future, it'd be more ideal to use a Node addon for more detailed and performant benchmarking.

I've been messing around with addons a little here and there, so this feature is still on the TODO list.
16 changes: 8 additions & 8 deletions src/lib/binaryHeap.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* {size} number, the amount of elements inside of the binary heap
* {compare} function, compares two elements to each other to determine the ordering of the heap
* defaults to basic (a < b) => true
*
*
* Asymptotic time complexities
* +-------------------------+
* | peek | O(1) |
Expand All @@ -13,11 +13,11 @@
* | delete | O(log(n)) |
* | heapify | O(nlog(n)) |
* +-------------------------+
*
*
* TODO: let user set a custom `equal` function
* @TODO dude redo this.. too messy
* @TODO dude redo this.. too messy
*/

'use strict';

/** @private
Expand All @@ -35,8 +35,8 @@ Array.prototype.swap = function(a, b){

/** @private @default
* Compares two elements and returns.
* @param {number} first index to compare
* @param {number} second index to compare
* @param {number} first index to compare
* @param {number} second index to compare
* @return {boolean} returns true if left hand element is less than right hand element
*/
function defaultCompare(a, b){
Expand Down Expand Up @@ -74,7 +74,7 @@ function safeCompare(a, b, callback){
const BinaryHeap = function(compare){
// Initialize heap with nulled first element
// because we aren't using first element (index 0).
// This is because of indexing reasons when finding
// This is because of indexing reasons when finding
// parent and children elements of the heap.
this.heap = [null];
this.compare = defaultCompare;
Expand Down Expand Up @@ -138,7 +138,7 @@ BinaryHeap.prototype.insert = function(data){
if(typeof data === 'undefined'){
throw new Error("Too few arguments for BinaryHeap.insert");
}
// Insert element to the end of the heap
// Insert element to the end of the heap
this.heap.push(data);

// If the heap only consists of the root, it's already in order so exit
Expand Down

0 comments on commit 4107719

Please sign in to comment.