-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8526d66
Showing
10 changed files
with
954 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
/dist | ||
/lib | ||
################################################ | ||
############### .gitignore ################## | ||
################################################ | ||
# | ||
# This file is only relevant if you are using git. | ||
# | ||
# Files which match the splat patterns below will | ||
# be ignored by git. This keeps random crap and | ||
# sensitive credentials from being uploaded to | ||
# your repository. It allows you to configure your | ||
# app for your machine without accidentally | ||
# committing settings which will smash the local | ||
# settings of other developers on your team. | ||
# | ||
# Some reasonable defaults are included below, | ||
# but, of course, you should modify/extend/prune | ||
# to fit your needs! | ||
################################################ | ||
|
||
|
||
|
||
|
||
################################################ | ||
# Local Configuration | ||
# | ||
# Explicitly ignore files which contain: | ||
# | ||
# 1. Sensitive information you'd rather not push to | ||
# your git repository. | ||
# e.g., your personal API keys or passwords. | ||
# | ||
# 2. Environment-specific configuration | ||
# Basically, anything that would be annoying | ||
# to have to change every time you do a | ||
# `git pull` | ||
# e.g., your local development database, or | ||
# the S3 bucket you're using for file uploads | ||
# development. | ||
# | ||
################################################ | ||
|
||
config/local.js | ||
|
||
|
||
|
||
|
||
|
||
################################################ | ||
# Dependencies | ||
# | ||
# When releasing a production app, you may | ||
# consider including your node_modules and | ||
# bower_components directory in your git repo, | ||
# but during development, its best to exclude it, | ||
# since different developers may be working on | ||
# different kernels, where dependencies would | ||
# need to be recompiled anyway. | ||
# | ||
# More on that here about node_modules dir: | ||
# http://www.futurealoof.com/posts/nodemodules-in-git.html | ||
# (credit Mikeal Rogers, @mikeal) | ||
# | ||
# About bower_components dir, you can see this: | ||
# http://addyosmani.com/blog/checking-in-front-end-dependencies/ | ||
# (credit Addy Osmani, @addyosmani) | ||
# | ||
################################################ | ||
|
||
node_modules | ||
bower_components | ||
|
||
|
||
|
||
|
||
################################################ | ||
# Sails.js / Waterline / Grunt | ||
# | ||
# Files generated by Sails and Grunt, or related | ||
# tasks and adapters. | ||
################################################ | ||
.tmp | ||
dump.rdb | ||
|
||
|
||
|
||
|
||
|
||
################################################ | ||
# Node.js / NPM | ||
# | ||
# Common files generated by Node, NPM, and the | ||
# related ecosystem. | ||
################################################ | ||
lib-cov | ||
*.seed | ||
*.log | ||
*.out | ||
*.pid | ||
npm-debug.log | ||
|
||
|
||
|
||
|
||
|
||
################################################ | ||
# Miscellaneous | ||
# | ||
# Common files generated by text editors, | ||
# operating systems, file systems, etc. | ||
################################################ | ||
|
||
*~ | ||
*# | ||
.DS_STORE | ||
.netbeans | ||
nbproject | ||
.idea | ||
.node_history | ||
|
||
|
||
# Coverage directory used by tools like istanbul | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
language: node_js | ||
|
||
node_js: | ||
- '4' | ||
- '5' | ||
- '6' | ||
|
||
script: | ||
- npm run test | ||
|
||
env: | ||
- CXX=g++-4.8 | ||
|
||
|
||
addons: | ||
apt: | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
packages: | ||
- g++-4.8 | ||
code_climate: | ||
repo_token: 4cee2f60edbf31acac6ddff823f0b93e2e9882c3e5c55130049e0fd878549f84 | ||
|
||
after_success: | ||
- npm run coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# DENQUE | ||
|
||
[](https://coveralls.io/github/Salakar/denque?branch=master) | ||
 | ||
[](https://www.npmjs.com/package/denque) | ||
[](https://david-dm.org/Salakar/denque) | ||
[](https://travis-ci.org/Salakar/denque) | ||
[](/LICENSE) | ||
|
||
|
||
## Benchmarks | ||
|
||
### 1000 items in queue | ||
|
||
denque x 31,015,027 ops/sec ±1.52% (86 runs sampled) | ||
double-ended-queue x 21,350,509 ops/sec ±1.21% (86 runs sampled) | ||
|
||
### 2 million items in queue | ||
|
||
denque x 28,710,051 ops/sec ±0.95% (87 runs sampled) | ||
double-ended-queue x 20,531,490 ops/sec ±1.04% (89 runs sampled) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict'; | ||
|
||
console.log("Platform info:"); | ||
|
||
const os = require("os"); | ||
const v8 = process.versions.v8; | ||
const node = process.versions.node; | ||
const plat = os.type() + " " + os.release() + " " + os.arch() + "\nNode.JS " + node + "\nV8 " + v8; | ||
|
||
let cpus = os.cpus().map(function (cpu) { | ||
return cpu.model; | ||
}).reduce(function (o, model) { | ||
if (!o[model]) o[model] = 0; | ||
o[model]++; | ||
return o; | ||
}, {}); | ||
|
||
cpus = Object.keys(cpus).map(function (key) { | ||
return key + " \u00d7 " + cpus[key]; | ||
}).join("\n"); | ||
|
||
console.log(plat + "\n" + cpus + "\n"); | ||
|
||
module.exports = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
'use strict'; | ||
|
||
require('./print'); | ||
|
||
const Benchmark = require('benchmark'); | ||
const suite = new Benchmark.Suite(); | ||
|
||
const Denque = require('./../'); | ||
const DoubleEndedQueue = require('double-ended-queue'); | ||
|
||
const denque = new Denque(); | ||
const doubleEndedQueue = new DoubleEndedQueue(); | ||
|
||
let l = 1000; | ||
|
||
while (--l) { | ||
denque.push(l); | ||
doubleEndedQueue.push(l); | ||
} | ||
|
||
suite | ||
.add('denque', function () { | ||
const a = denque.shift(); | ||
const b = denque.shift(); | ||
const c = denque.shift(); | ||
|
||
denque.push(a); | ||
denque.push(b); | ||
denque.push(c); | ||
}) | ||
.add('double-ended-queue', function () { | ||
const a = doubleEndedQueue.shift(); | ||
const b = doubleEndedQueue.shift(); | ||
const c = doubleEndedQueue.shift(); | ||
|
||
doubleEndedQueue.push(a); | ||
doubleEndedQueue.push(b); | ||
doubleEndedQueue.push(c); | ||
}) | ||
.on('cycle', function (e) { | ||
console.log('' + e.target); | ||
}) | ||
.run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
'use strict'; | ||
|
||
require('./print'); | ||
|
||
const Benchmark = require('benchmark'); | ||
const suite = new Benchmark.Suite(); | ||
|
||
const Denque = require('./../'); | ||
const DoubleEndedQueue = require('double-ended-queue'); | ||
|
||
const denque = new Denque(); | ||
const doubleEndedQueue = new DoubleEndedQueue(); | ||
|
||
let l = 2000000; | ||
|
||
while (--l) { | ||
denque.push(l); | ||
doubleEndedQueue.push(l); | ||
} | ||
|
||
suite | ||
.add('denque', function () { | ||
const a = denque.shift(); | ||
const b = denque.shift(); | ||
const c = denque.shift(); | ||
|
||
denque.push(a); | ||
denque.push(b); | ||
denque.push(c); | ||
}) | ||
.add('double-ended-queue', function () { | ||
const a = doubleEndedQueue.shift(); | ||
const b = doubleEndedQueue.shift(); | ||
const c = doubleEndedQueue.shift(); | ||
|
||
doubleEndedQueue.push(a); | ||
doubleEndedQueue.push(b); | ||
doubleEndedQueue.push(c); | ||
}) | ||
.on('cycle', function (e) { | ||
console.log('' + e.target); | ||
}) | ||
.run(); |
Oops, something went wrong.