forked from deepstreamIO/deepstream.io
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
55 changed files
with
2,314 additions
and
2,111 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,38 @@ | ||
'use strict' | ||
|
||
const messageHandler = require('../src/cluster/messaging/message-handler') | ||
const assert = require('assert') | ||
|
||
const fs = require('fs') | ||
|
||
const data = fs.readFileSync('./test-data.bin') | ||
const Benchmark = require('benchmark') | ||
|
||
const suite = new Benchmark('parser', () => { | ||
let readBuffer = data | ||
let result | ||
do { | ||
result = messageHandler.tryParseBinaryMsg(readBuffer, err => console.log('parse error', err)) | ||
if (result.bytesConsumed > 0) { | ||
// this._onMessage(result.message) | ||
readBuffer = readBuffer.slice(result.bytesConsumed) | ||
} | ||
} while (readBuffer.length !== 0 && result.bytesConsumed !== 0) | ||
assert(readBuffer.length === 0) | ||
}, { | ||
maxTime: 10, | ||
onComplete () { | ||
console.log(`The mean run time after ${this.count} iterations was ${ | ||
this.stats.mean * 1000} ± ${this.stats.deviation * 1000} ms`) | ||
console.log(`Variance ${this.stats.variance.toExponential(9)}`) | ||
}, | ||
onError (err) { | ||
console.error('an error occurred', err) | ||
throw err | ||
}, | ||
onAbort (err) { | ||
console.error('an abort occurred', err) | ||
throw err | ||
} | ||
}) | ||
suite.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
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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
var Jasmine = require('jasmine') | ||
var SpecReporter = require('jasmine-spec-reporter').SpecReporter | ||
var noop = function() {} | ||
|
||
var jrunner = new Jasmine() | ||
var jasmine = global.jasmine | ||
jrunner.configureDefaultReporter({ print: noop }) // remove default reporter logs | ||
jasmine.getEnv().addReporter(new SpecReporter()) // add jasmine-spec-reporter | ||
jrunner.loadConfigFile('./jasmine.json') // load jasmine.json configuration | ||
jrunner.execute() |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Oops, something went wrong.