Last active
August 31, 2015 15:45
-
-
Save blackrabbit99/c5dcf0406b41248bda15 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.onmessage = function(e){ | |
var Float32ArrayView = new Float32Array(e.data); | |
Float32ArrayView[0] = 2; | |
self.postMessage(Float32ArrayView.buffer, [Float32ArrayView.buffer]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<script> | |
var wrk = new Worker('./w.js'); | |
var arrayBuffer = new ArrayBuffer(1024 * 1024 * 32); | |
var Float32ArrayO = new Float32Array(arrayBuffer); | |
var originalLength = Float32ArrayO.length; | |
wrk.onmessage = function (e) { | |
console.timeEnd('worker'); | |
var Float32ArrayO = new Float32Array(e.data); | |
wrk.terminate(); | |
}; | |
var run = function(){ | |
console.time('worker'); | |
wrk.postMessage(Float32ArrayO.buffer, [Float32ArrayO.buffer]); | |
}; | |
setTimeout(run, 0); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<script> | |
var wrk = new Worker('./w.js'); | |
var arrayBuffer = new ArrayBuffer(1024 * 1024 * 32); | |
var Float32ArrayO = new Float32Array(arrayBuffer); | |
var originalLength = Float32ArrayO.length; | |
wrk.onmessage = function (e) { | |
console.timeEnd('worker'); | |
var Float32ArrayO = new Float32Array(e.data); | |
wrk.terminate(); | |
}; | |
var run = function(){ | |
console.time('worker'); | |
wrk.postMessage(Float32ArrayO.buffer, [Float32ArrayO.buffer]); | |
}; | |
setTimeout(run, 200); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<script> | |
var wrk = new Worker('./w.js'); | |
var arrayBuffer = new ArrayBuffer(1024 * 1024 * 32); | |
var Float32ArrayO = new Float32Array(arrayBuffer); | |
var originalLength = Float32ArrayO.length; | |
wrk.onmessage = function (e) { | |
console.timeEnd('worker'); | |
var Float32ArrayO = new Float32Array(e.data); | |
wrk.terminate(); | |
}; | |
var run = function(){ | |
console.time('worker'); | |
wrk.postMessage(Float32ArrayO.buffer, [Float32ArrayO.buffer]); | |
}; | |
run(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment