repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bump standard from 15.0.0 to 15.0.1
[poolifier.git]
/
benchmarks
/
yourWorker.js
diff --git
a/benchmarks/yourWorker.js
b/benchmarks/yourWorker.js
index 9c250220e8a510d1a9beeb589bb9300298add6ee..ac3959d121f1fcfa123f1118374a1c4b3d2bcf4f 100644
(file)
--- a/
benchmarks/yourWorker.js
+++ b/
benchmarks/yourWorker.js
@@
-1,18
+1,15
@@
'use strict'
const { ThreadWorker } = require('../lib/workers')
'use strict'
const { ThreadWorker } = require('../lib/workers')
-class MyWorker extends ThreadWorker {
- constructor () {
- super((data) => {
- for (let i = 0; i <= 1000; i++) {
- const o = {
- a: i
- }
- JSON.stringify(o)
- }
- // console.log('This is the main thread ' + isMainThread)
- return { ok: 1 }
- })
+function yourFunction (data) {
+ for (let i = 0; i <= 1000; i++) {
+ const o = {
+ a: i
+ }
+ JSON.stringify(o)
}
}
+ // console.log('This is the main thread ' + isMainThread)
+ return { ok: 1 }
}
}
-module.exports = new MyWorker()
+
+module.exports = new ThreadWorker(yourFunction)