Skip to content

Commit

Permalink
v5.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
austinksmith committed Jun 12, 2024
1 parent 6e9dc6e commit 48da3fb
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion build/hamsters.node.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/hamsters.node.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/hamsters.web.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/hamsters.web.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "Austin K Smith",
"description": "100% Vanilla Javascript Multithreading & Parallel Execution Library",
"homepage": "http://www.hamsters.io/",
"version": "5.5.2",
"version": "5.5.3",
"main": "build/hamsters.node.min.js",
"scripts": {
"build": "rm -rf ./build && webpack --config ./hamsters.webpack.config.js && npm run copy-common",
Expand Down
46 changes: 23 additions & 23 deletions src/hamsters.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class hamstersjs {
constructor() {
'use strict';

this.version = '5.5.2';
this.version = '5.5.3';
this.run = this.hamstersRun.bind(this);
this.promise = this.hamstersPromise.bind(this);
this.init = this.inititializeLibrary.bind(this);
Expand Down Expand Up @@ -84,36 +84,36 @@ class hamstersjs {
hamstersTask(params, functionToRun) {
params.array = params.array || [];
const task = {
input: {},
output: [],
scheduler: {
count: 0,
threads: params.threads || 1,
workers: []
}
input: {},
output: [],
scheduler: {
count: 0,
threads: params.threads || 1,
workers: []
}
};

if (this.habitat.legacy) {
task.scheduler.threads = 1;
if (!this.habitat.node && !this.habitat.isIE) {
params.hamstersJob = functionToRun;
}
task.scheduler.threads = 1;
if (!this.habitat.node && !this.habitat.isIE) {
params.hamstersJob = functionToRun;
}
} else {
params.hamstersJob = this.habitat.legacy ? functionToRun : this.data.prepareFunction(functionToRun);
if (params.sharedArray && this.habitat.atomics) {
task.scheduler.indexes = params.indexes || this.data.getSubArrayIndexes(params.sharedArray, task.scheduler.threads);
task.scheduler.sharedBuffer = this.data.setupSharedArrayBuffer(params.sharedArray);
} else {
task.scheduler.indexes = params.indexes || this.data.getSubArrayIndexes(params.array, task.scheduler.threads);
}
params.hamstersJob = this.habitat.legacy ? functionToRun : this.data.prepareFunction(functionToRun);
if (params.sharedArray && this.habitat.atomics) {
task.scheduler.indexes = params.indexes || this.data.getSubArrayIndexes(params.sharedArray, task.scheduler.threads);
task.scheduler.sharedBuffer = this.data.setupSharedArrayBuffer(params.sharedArray);
} else {
task.scheduler.indexes = params.indexes || this.data.getSubArrayIndexes(params.array, task.scheduler.threads);
}
}

if (this.habitat.debug) {
task.scheduler.metrics = {
created_at: Date.now(),
started_at: null,
completed_at: null,
threads: []
created_at: Date.now(),
started_at: null,
completed_at: null,
threads: []
};
}

Expand Down

0 comments on commit 48da3fb

Please sign in to comment.