From 522eea0367c1381247471bc4393ae9c9de398120 Mon Sep 17 00:00:00 2001 From: aardizio Date: Fri, 24 Jan 2020 19:58:23 +0100 Subject: [PATCH] Adding a changelog file , removing other library dev dependencies and bench, add npm ignore file --- .gitignore | 1 + .npmignore | 4 ++++ CHANGELOG.md | 14 ++++++++++++++ benchmarks/bench.js | 29 ----------------------------- package.json | 5 ++--- 5 files changed, 21 insertions(+), 32 deletions(-) create mode 100644 .npmignore create mode 100644 CHANGELOG.md diff --git a/.gitignore b/.gitignore index 2ac23b4d..6c68f3af 100644 --- a/.gitignore +++ b/.gitignore @@ -41,5 +41,6 @@ jspm_packages # Mac .DS_Store/ +.DS_Store .history/ \ No newline at end of file diff --git a/.npmignore b/.npmignore new file mode 100644 index 00000000..e9ee2442 --- /dev/null +++ b/.npmignore @@ -0,0 +1,4 @@ +.github +benchmarks +examples +tests \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..f9ffd375 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,14 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.0.0] - 2020-24-01 + +### Added + +- FixedThreadPool implementation +- DynamicThreadPool implementation +- WorkerThread implementation to improve developer experience \ No newline at end of file diff --git a/benchmarks/bench.js b/benchmarks/bench.js index d7b2f1a3..0dde5055 100644 --- a/benchmarks/bench.js +++ b/benchmarks/bench.js @@ -2,12 +2,10 @@ const Benchmark = require('benchmark') const suite = new Benchmark.Suite() const FixedThreadPool = require('../lib/fixed') const DynamicThreadPool = require('../lib/dynamic') -const Pool = require('worker-threads-pool') const size = 30 const tasks = 1 // pools -const externalPool = new Pool({ max: size }) const fixedPool = new FixedThreadPool(size, './yourWorker.js', { maxTasks: 10000 }) const dynamicPool = new DynamicThreadPool(size / 2, size * 3, './yourWorker.js', { maxTasks: 10000 }) @@ -47,30 +45,6 @@ async function dynamicTest () { }) } -async function externalPoolTest () { - return new Promise((resolve, reject) => { - let executions = 0 - for (let i = 0; i <= tasks; i++) { - new Promise((resolve, reject) => { - externalPool.acquire('./externalWorker.js', { workerData: workerData }, (err, worker) => { - if (err) { - return reject(err) - } - worker.on('error', reject) - worker.on('message', res => { - executions++ - resolve(res) - }) - }) - }).then(res => { - if (tasks === executions) { - resolve('FINISH') - } - }) - } - }) -} - async function test () { // add tests suite.add('PioardiStaticPool', async function () { @@ -79,9 +53,6 @@ async function test () { .add('PioardiDynamicPool', async function () { await dynamicTest() }) - .add('ExternalPool', async function () { - await externalPoolTest() - }) // add listeners .on('cycle', function (event) { console.log(String(event.target)) diff --git a/package.json b/package.json index 88d328a2..e8d7e795 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "poolifier", - "version": "0.0.2", + "version": "1.0.0", "description": "Library on top of node js worker threads that implement various worker pools type", "main": "index.js", "scripts": { @@ -44,8 +44,7 @@ "mocha": "^7.0.0", "mocha-lcov-reporter": "^1.3.0", "nyc": "^15.0.0", - "standard": "^14.3.1", - "worker-threads-pool": "^2.0.0" + "standard": "^14.3.1" }, "engines": { "node": ">=12.0.0" -- 2.34.1