Uname:Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64

Base Dir : /var/www/html

User : gavin


403WebShell
403Webshell
Server IP : 68.183.124.220  /  Your IP : 216.73.217.137
Web Server : Apache/2.4.18 (Ubuntu)
System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64
User : gavin ( 1000)
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/gavin/workspace/happymandarin/node_modules/event-emitter/benchmark/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gavin/workspace/happymandarin/node_modules/event-emitter/benchmark/many-on.js
'use strict';

// Benchmark comparing performance of event emit for many listeners
// To run it, do following in memoizee package path:
//
// $ npm install eventemitter2 signals
// $ node benchmark/many-on.js

var forEach    = require('es5-ext/object/for-each')
  , pad        = require('es5-ext/string/#/pad')

  , now = Date.now

  , time, count = 1000000, i, data = {}
  , ee, native, ee2, signals, a = {}, b = {};

ee = (function () {
	var ee = require('../')();
	ee.on('test', function () { return arguments; });
	ee.on('test', function () { return arguments; });
	return ee.on('test', function () { return arguments; });
}());

native = (function () {
	var ee = require('events');
	ee = new ee.EventEmitter();
	ee.on('test', function () { return arguments; });
	ee.on('test', function () { return arguments; });
	return ee.on('test', function () { return arguments; });
}());

ee2 = (function () {
	var ee = require('eventemitter2');
	ee = new ee.EventEmitter2();
	ee.on('test', function () { return arguments; });
	ee.on('test', function () { return arguments; });
	return ee.on('test', function () { return arguments; });
}());

signals = (function () {
	var Signal = require('signals')
	  , ee = { test: new Signal() };
	ee.test.add(function () { return arguments; });
	ee.test.add(function () { return arguments; });
	ee.test.add(function () { return arguments; });
	return ee;
}());

console.log("Emit for 3 listeners", "x" + count + ":\n");

i = count;
time = now();
while (i--) {
	ee.emit('test', a, b);
}
data["event-emitter (this implementation)"] = now() - time;

i = count;
time = now();
while (i--) {
	native.emit('test', a, b);
}
data["EventEmitter (Node.js native)"] = now() - time;

i = count;
time = now();
while (i--) {
	ee2.emit('test', a, b);
}
data.EventEmitter2 = now() - time;

i = count;
time = now();
while (i--) {
	signals.test.dispatch(a, b);
}
data.Signals = now() - time;

forEach(data, function (value, name, obj, index) {
	console.log(index + 1 + ":",  pad.call(value, " ", 5), name);
}, null, function (a, b) {
	return this[a] - this[b];
});

Youez - 2016 - github.com/yon3zu
LinuXploit