Second Reality running in JavaScript
category: offtopic [glöplog]
Quote:
Start accepting the world turning to video. It will happen. real time is dead, long live video!
The point is that some sad moron with no friends and too much time is needed, stupid enough to spend his time capturing an encoding video. Only a handful of people in the scene fit this description (aw, yeah I did a lot of videos too) and thus a lot of videos are missing. With click-to-emulator(tm) this wouldn't be necessary anymore...
Sorry to resurrect a long dead thread. JsDosbox
jsdosbox.sourceforge.net now runs somewhat faster, sort of does sound emulation (inc. gus), reads zip files and some other things. Most retro DOS demos will run at a slideshow like pace, if they run at all. Tips/Info on project page. Changing the config dials can improve things. The emulator currently has problems with text based setup menus. If you quickly bash the enter key when execution starts sometimes the defaults are registered. Chrome browser recommended. The Js eval() dynarec core works, but not worth selecting as Browser JITs don't like it much.
jsdosbox.sourceforge.net now runs somewhat faster, sort of does sound emulation (inc. gus), reads zip files and some other things. Most retro DOS demos will run at a slideshow like pace, if they run at all. Tips/Info on project page. Changing the config dials can improve things. The emulator currently has problems with text based setup menus. If you quickly bash the enter key when execution starts sometimes the defaults are registered. Chrome browser recommended. The Js eval() dynarec core works, but not worth selecting as Browser JITs don't like it much.
nice
Quote:
The Js eval() dynarec core works, but not worth selecting as Browser JITs don't like it much.
Have you tried indirect eval, by any chance? (Sorry if that's a dumb question - for all I know you might be way past that point and digging into browser internals, but I figured it was worth mentioning in case there's an instant fix there...)
I hear sound coming from second reality... but it stutters so badly that it's ear cancer... But it's getting there. Keep going :) I'd like to have a full quality second reality only one click away!
Emulating DOS in JavaScript is surely going to save the planet.
seems they have remove prince of persia on jsdosbox page... shit i wanted to try sound emulation :(
@gasman
Cheers. Didn't know about indirect eval(). Another thing to add to the TODO list.
@Tigrou
Probably just the daily bandwidth limit been exceeded.
Cheers. Didn't know about indirect eval(). Another thing to add to the TODO list.
@Tigrou
Probably just the daily bandwidth limit been exceeded.
Sorry, but is JSDosBox actually written in Java and "transpiled" to JavaScript using GWT ?
Essentially. There is some 8k odd of JSNI type stuff for the Js spewing core used when building code blocks. I had great hopes for GWT 2.5 as it integrated the closure compiler. Makes the code 30% smaller, but no noticeable performance increase.
:\
Makes me wonder then why not "simply" compile JDosBox to LLVM and Emscripten the shit out of it.
Makes me wonder then why not "simply" compile JDosBox to LLVM and Emscripten the shit out of it.
YES YES!
it does not work here...with chrome indeed !
Javascript performance is a puzzling kind of headache.
And by that I mean: http://cpcbox.com/bench.htm
And by that I mean: http://cpcbox.com/bench.htm
...more like Second Reality NOT running in JavaScript ;)
If you're going to homage a demo, HOMAGE A DIFFERENT DEMO.
Seriously.
It isn't a bad demo, but there are others that also deserve this honor I am sure.
And for the comment above +1 raer. snerk.
Seriously.
It isn't a bad demo, but there are others that also deserve this honor I am sure.
And for the comment above +1 raer. snerk.
@div0 : or maybe someone complains about prince of persia copyright infringement
@phi2x : it seems this test is more a string instantiation benchmark than a cpu emulation bench. it would have probably been smarter to increase/decrease global variables (to simulate registers activity) instead of returning theses strings (unless returning new strings in js have no costs which is something i'm not sure).
@phi2x : it seems this test is more a string instantiation benchmark than a cpu emulation bench. it would have probably been smarter to increase/decrease global variables (to simulate registers activity) instead of returning theses strings (unless returning new strings in js have no costs which is something i'm not sure).
now farbrausch has released werkkzeug source, what about porting the player to js and watch your favorite browser throwing debris ? (at 0.1 fps off course)
I'm with the guys that think video defeats the purpose of demo and all ad I'm ashamed of saying this, but... Youtube has something more, a ckickable time bar!
@Tigrou: ok, point taken ;)
In fact, I started from my real Z80 opcode dispatcher and it already showed that huge speed difference between Chrome and Firefox.
So I'm sure that the guilt is the huge switch itself and not the string instanciation that I've put in for simplicity stake.
But feel free to modify the bench and publish your findings.
In fact, I started from my real Z80 opcode dispatcher and it already showed that huge speed difference between Chrome and Firefox.
So I'm sure that the guilt is the huge switch itself and not the string instanciation that I've put in for simplicity stake.
But feel free to modify the bench and publish your findings.
@Tigrou: M'kay, I realized I had a poor argument and I had to prove my point :D
So, I reworked the benchmark to get rid of string instancing. It's now closer to my real Z80 dispatcher. Check it here: http://cpcbox.com/bench.htm
You'll see that the benchmark results still say the same thing...
So, I reworked the benchmark to get rid of string instancing. It's now closer to my real Z80 dispatcher. Check it here: http://cpcbox.com/bench.htm
You'll see that the benchmark results still say the same thing...
phi2x: I tried you benchmark at work ( win7, plenty of ram and a beefy cpu ) and get the following:
Replacing the switch with a simple array of function, I get:
As we can see, switch is a bitch. The various implementations varies greatly. Probably too much for any such use case.
Either way, remember that each of your "calls/sec" actually does 1.000.000 function call and return. So we're talking about an average of 75.000.000 function calls and return per second; not too shady for a script language. I bet that inlining all this would yield significantly better results.
* 120 calls / sec in Firefox Aurora
* 75 calls / sec in Opera 12.50
* 5 calls / sec in Chrome Canary
Replacing the switch with a simple array of function, I get:
* 65 calls / sec in Firefox Aurora
* 75 calls / sec in Opera 12.50
* 85 calls / sec in Chrome Canary
As we can see, switch is a bitch. The various implementations varies greatly. Probably too much for any such use case.
Either way, remember that each of your "calls/sec" actually does 1.000.000 function call and return. So we're talking about an average of 75.000.000 function calls and return per second; not too shady for a script language. I bet that inlining all this would yield significantly better results.
@p01 : very interesting (and disappointing at the same time :)
if some of you are interested in porting things from C/C++ to js here is some pages that can be interesting :
http://emscripten.org/ ( LLVM-to-JavaScript compiler )
http://clang.llvm.org/ (C/C++ to LLVM)
http://code.google.com/p/closure-compiler/ (to reduce and optimize js)
and to finish a js port of OpenTTD game :
http://play-ttd.com/
Surprisingly, it doesn't run too bad (at least on chrome). But remember this game ran almost full speed on a 486 back then !
and if you want other examples, look at emscripten page
if some of you are interested in porting things from C/C++ to js here is some pages that can be interesting :
http://emscripten.org/ ( LLVM-to-JavaScript compiler )
http://clang.llvm.org/ (C/C++ to LLVM)
http://code.google.com/p/closure-compiler/ (to reduce and optimize js)
and to finish a js port of OpenTTD game :
http://play-ttd.com/
Surprisingly, it doesn't run too bad (at least on chrome). But remember this game ran almost full speed on a 486 back then !
and if you want other examples, look at emscripten page
SUKKZ!