Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Commit

Permalink
WIP broken
Browse files Browse the repository at this point in the history
faster Promise2 (using Microtask) that won't allow to idle when tasks available
  • Loading branch information
soywiz committed May 4, 2015
1 parent 2e500a9 commit 728a498
Show file tree
Hide file tree
Showing 59 changed files with 2,638 additions and 3,450 deletions.
69 changes: 34 additions & 35 deletions benchmark.html
@@ -1,35 +1,34 @@
<!DOCTYPE html>
<html>
<head></head>
<body>
<script type="text/javascript" src="source/polyfills/promise.js"></script>
<script type="text/javascript" src="jspspemu.js"></script>
<div id="output" style="font: 14px 'Lucida Console', Monaco, monospace;white-space: pre;"></div>
<div id="errors" style="font: 14px 'Lucida Console', Monaco, monospace;white-space: pre;color:red;"></div>
<script type="text/javascript">
var errors = document.getElementById('errors');

window.onerror = function (errorMsg, url, lineNumber) {
errors.innerText += 'Error: ' + errorMsg + ' Script: ' + url + ' Line: ' + lineNumber + "\n";
};

var Emulator = require('src/emulator').Emulator;
var MemoryAsyncStream = require('src/core/stream').MemoryAsyncStream2;
//Emulator.disableLog();
var emu = new Emulator();
var output = document.getElementById('output');

UrlAsyncStream.fromUrlAsync('data/benchmark/benchmark.prx').then(function(stream) {
return emu.loadExecuteAndWaitAsync(stream, 'benchmark.prx', function() {
emu.context.onStdout.add(function(data) {
output.textContent = output.textContent + data;
//console.log(data);
//process.stdout.write(data);
});
}).then(function(output) {
//console.log(output);
});
});
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head></head>
<body>
<script type="text/javascript" src="jspspemu.js"></script>
<div id="output" style="font: 14px 'Lucida Console', Monaco, monospace;white-space: pre;"></div>
<div id="errors" style="font: 14px 'Lucida Console', Monaco, monospace;white-space: pre;color:red;"></div>
<script type="text/javascript">
var errors = document.getElementById('errors');

window.onerror = function (errorMsg, url, lineNumber) {
errors.innerText += 'Error: ' + errorMsg + ' Script: ' + url + ' Line: ' + lineNumber + "\n";
};

var Emulator = require('src/emulator').Emulator;
var MemoryAsyncStream = require('src/core/stream').MemoryAsyncStream2;
//Emulator.disableLog();
var emu = new Emulator();
var output = document.getElementById('output');

UrlAsyncStream.fromUrlAsync('data/benchmark/benchmark.prx').then(function(stream) {
return emu.loadExecuteAndWaitAsync(stream, 'benchmark.prx', function() {
emu.context.onStdout.add(function(data) {
output.textContent = output.textContent + data;
//console.log(data);
//process.stdout.write(data);
});
}).then(function(output) {
//console.log(output);
});
});
</script>
</body>
</html>
Binary file modified data/benchmark/benchmark.prx
Binary file not shown.
2 changes: 1 addition & 1 deletion data/benchmark/main.c
Expand Up @@ -64,7 +64,6 @@ void testSimpleLoop()
}
}
outResult = sum;
//asm("dbreak\n");
}


Expand Down Expand Up @@ -194,6 +193,7 @@ void runTest9a()
runTest9b();
runTest9b();
runTest9b();
asm("dbreak\n");
}

void runTest9()
Expand Down
1 change: 0 additions & 1 deletion index.html
Expand Up @@ -22,7 +22,6 @@
<script src="source/lib/jquery-2.1.0.js"></script>
<script src="source/lib/underscore.js"></script>
<script src="source/lib/FileSaver.js"></script>
<script src="source/polyfills/promise.js"></script>
<script src="source/lib/moment.min.js"></script>

<!--
Expand Down

0 comments on commit 728a498

Please sign in to comment.