This file contains hidden or 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
| var startFast; | |
| var startSlow; | |
| var size = 1000000; // million | |
| var fast = function () { | |
| for ( var i = 0; i < size; i++ ) { | |
| ( function () { | |
| var j = i; | |
| return function () { |
This file contains hidden or 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
| var startFast; | |
| var startSlow; | |
| var size = 1000000; // million | |
| var loopCount = 0; | |
| var loopTest = function () { | |
| loopCount++; | |
| if ( loopCount == ( size - 1 ) ) | |
| console.log( 'loop result: ' + ( new Date() - startFast ) + 'ms' ); |
This file contains hidden or 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
| var startLoop; | |
| var startNextTick; | |
| var size = 1000000; // million | |
| var loopCount = 0; | |
| var noop = 0; | |
| var loopTest = function () { | |
| loopCount++; | |
| if ( loopCount < ( size - 1 ) ) |
This file contains hidden or 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
| (function (ctr,t) { | |
| function inc () { ctr++ } | |
| function display (ntps,ntpsStr,i,lps,lpsStr,ratioStr) { | |
| ntps= ctr*1e3/(Date.now()-t); //nextTicks per second | |
| ntpsStr= ", nextTicksPerSecond: "+ ntps.toFixed(1); | |
| ctr= 0; | |
| i= 100e6; |
This file contains hidden or 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
| var typeOneAPrototype = exports.typeOneAPrototype = $$( { | |
| model : {}, | |
| view : { | |
| format : '<div>obj oneA</div>' | |
| } | |
| }); // typeOneAPrototype |
This file contains hidden or 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
| var NVector = module.exports = function NVector (x, y, z) { | |
| var self = this; | |
| self.x = x; | |
| self.y = y; | |
| self.z = z; | |
| }; |
This file contains hidden or 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
| var Gossipmonger = require('../index.js'); | |
| var gossipmonger = new Gossipmonger( | |
| { | |
| id: String(Math.random()*1E17), | |
| transport: { | |
| host: "0.0.0.0", | |
| port: 9742 | |
| } | |
| }, |
This file contains hidden or 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
| sjcl (http://crypto.stanford.edu/sjcl/) | |
| crypto-js (https://code.google.com/p/crypto-js/) | |
| jsCrypto (https://code.google.com/p/jscryptolib/) | |
| triplesec (https://github.com/keybase/triplesec) | |
| polycrypt (https://github.com/polycrypt) |
This file contains hidden or 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
| function dostuff(callback) { | |
| task1(function(x) { | |
| task2(x, function(y) { | |
| task3(y, function(z) { | |
| if (z < 0) { | |
| callback(0); | |
| } else { | |
| callback(z); | |
| }); | |
| }); |
This file contains hidden or 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
| var dostuffEmitter = new EventEmitter(); | |
| dostuffEmitter.on('task1', function (callback) { | |
| dostuffEmitter.emit('task2', x, callback); | |
| }); | |
| dostuffEmitter.on('task2', function (x, callback) { | |
| dostuffEmitter.emit('task3', y, callback); | |
| }); |
OlderNewer