Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hbi99/x10.js
Web worker wrapper with simple interface
https://github.com/hbi99/x10.js
Last synced: about 2 months ago
JSON representation
Web worker wrapper with simple interface
- Host: GitHub
- URL: https://github.com/hbi99/x10.js
- Owner: hbi99
- License: mit
- Created: 2015-01-18T14:46:30.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-11-20T21:10:43.000Z (almost 6 years ago)
- Last Synced: 2024-07-05T10:31:58.649Z (3 months ago)
- Language: JavaScript
- Size: 18.6 KB
- Stars: 13
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# x10.js
Using __x10.js__, long-running scripts can run in a dedicated thread and thereby have a non-blocking effect on the UI-thread. In Firefox and Safari, scripts in the dedicated thread runs even faster than in UI-thread (in some cases, ten times faster).The interface of __x10.js__ is very easy and migrating to / from __x10.js__ have minimal impact on your code.
```js
var obj = {
loop: function(len) {
while (len--) {}
}
};// UI thread IS blocked when executing this
var start = Date.now();
obj.loop(100000000);
console.log( Date.now() - start );
// 990 milliseconds// compile the object with 'x10.js'
var task = x10.compile(obj);// worker thread - UI thread is NOT blocked when executing this
start = Date.now();
task.loop(100000000, function() {
console.log( Date.now() - start );
// 146 milliseconds
});
```