0.1.3 • Published 7 years ago

x10.js v0.1.3

Weekly downloads
331
License
MIT
Repository
github
Last release
7 years ago

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.

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
});