repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
docs: refine changelog entries
[poolifier.git]
/
benchmarks
/
benchmarks-utils.js
diff --git
a/benchmarks/benchmarks-utils.js
b/benchmarks/benchmarks-utils.js
index 64df58c87b4a3b1c671a73695ef5905cd195c6df..eb3a4f945f40a64a95e010fe375b81c4bb874090 100644
(file)
--- a/
benchmarks/benchmarks-utils.js
+++ b/
benchmarks/benchmarks-utils.js
@@
-1,16
+1,16
@@
const crypto = require('crypto')
const fs = require('fs')
const crypto = require('crypto')
const fs = require('fs')
-const {
- PoolTypes,
- WorkerFunctions,
- WorkerTypes
-} = require('./benchmarks-types')
const {
DynamicClusterPool,
DynamicThreadPool,
FixedClusterPool,
FixedThreadPool
} = require('../lib')
const {
DynamicClusterPool,
DynamicThreadPool,
FixedClusterPool,
FixedThreadPool
} = require('../lib')
+const {
+ PoolTypes,
+ WorkerFunctions,
+ WorkerTypes
+} = require('./benchmarks-types')
async function runTest (pool, { taskExecutions, workerData }) {
return new Promise((resolve, reject) => {
async function runTest (pool, { taskExecutions, workerData }) {
return new Promise((resolve, reject) => {
@@
-56,7
+56,6
@@
function jsonIntegerSerialization (n) {
/**
* Intentionally inefficient implementation.
/**
* Intentionally inefficient implementation.
- *
* @param {number} n - The number of fibonacci numbers to generate.
* @returns {number} - The nth fibonacci number.
*/
* @param {number} n - The number of fibonacci numbers to generate.
* @returns {number} - The nth fibonacci number.
*/
@@
-67,7
+66,6
@@
function fibonacci (n) {
/**
* Intentionally inefficient implementation.
/**
* Intentionally inefficient implementation.
- *
* @param {number} n - The number to calculate the factorial of.
* @returns {number} - The factorial of n.
*/
* @param {number} n - The number to calculate the factorial of.
* @returns {number} - The factorial of n.
*/
@@
-114,17
+112,17
@@
function executeWorkerFunction (data) {
}
}
}
}
-function buildPool (
poolType, poolSize, workerTyp
e, poolOptions) {
+function buildPool (
workerType, poolType, poolSiz
e, poolOptions) {
switch (poolType) {
switch (poolType) {
- case PoolTypes.
FIXED
:
+ case PoolTypes.
fixed
:
switch (workerType) {
switch (workerType) {
- case WorkerTypes.
THREAD
:
+ case WorkerTypes.
thread
:
return new FixedThreadPool(
poolSize,
'./benchmarks/internal/thread-worker.js',
poolOptions
)
return new FixedThreadPool(
poolSize,
'./benchmarks/internal/thread-worker.js',
poolOptions
)
- case WorkerTypes.
CLUSTER
:
+ case WorkerTypes.
cluster
:
return new FixedClusterPool(
poolSize,
'./benchmarks/internal/cluster-worker.js',
return new FixedClusterPool(
poolSize,
'./benchmarks/internal/cluster-worker.js',
@@
-132,16
+130,16
@@
function buildPool (poolType, poolSize, workerType, poolOptions) {
)
}
break
)
}
break
- case PoolTypes.
DYNAMIC
:
+ case PoolTypes.
dynamic
:
switch (workerType) {
switch (workerType) {
- case WorkerTypes.
THREAD
:
+ case WorkerTypes.
thread
:
return new DynamicThreadPool(
poolSize / 2,
poolSize * 3,
'./benchmarks/internal/thread-worker.js',
poolOptions
)
return new DynamicThreadPool(
poolSize / 2,
poolSize * 3,
'./benchmarks/internal/thread-worker.js',
poolOptions
)
- case WorkerTypes.
CLUSTER
:
+ case WorkerTypes.
cluster
:
return new DynamicClusterPool(
poolSize / 2,
poolSize * 3,
return new DynamicClusterPool(
poolSize / 2,
poolSize * 3,