pouët.net

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...
added on the 2011-09-27 17:56:55 by raer raer
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.
added on the 2012-08-07 10:47:00 by div0 div0
nice
added on the 2012-08-07 11:29:40 by wullon wullon
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...)
added on the 2012-08-07 12:35:47 by gasman gasman
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!
added on the 2012-08-07 22:57:11 by xTr1m xTr1m
Emulating DOS in JavaScript is surely going to save the planet.
added on the 2012-08-07 23:12:12 by noname noname
seems they have remove prince of persia on jsdosbox page... shit i wanted to try sound emulation :(
added on the 2012-08-08 00:17:12 by Tigrou Tigrou
@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.
added on the 2012-08-08 11:42:46 by div0 div0
Sorry, but is JSDosBox actually written in Java and "transpiled" to JavaScript using GWT ?
added on the 2012-08-08 12:02:08 by p01 p01
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.
added on the 2012-08-08 13:26:17 by div0 div0
:\

Makes me wonder then why not "simply" compile JDosBox to LLVM and Emscripten the shit out of it.
added on the 2012-08-08 13:39:43 by p01 p01
YES YES!
added on the 2012-08-08 15:59:05 by mrdoob mrdoob
it does not work here...with chrome indeed !
added on the 2012-08-08 17:50:08 by Bartoshe Bartoshe
Javascript performance is a puzzling kind of headache.
And by that I mean: http://cpcbox.com/bench.htm
added on the 2012-08-08 17:59:05 by RetroVM RetroVM
...more like Second Reality NOT running in JavaScript ;)
added on the 2012-08-08 18:05:48 by raer raer
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.
@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).
added on the 2012-08-08 20:53:37 by Tigrou Tigrou
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)
added on the 2012-08-08 21:01:02 by Tigrou Tigrou
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.
added on the 2012-08-08 23:03:22 by RetroVM RetroVM
@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...
added on the 2012-08-09 02:17:17 by RetroVM RetroVM
phi2x: I tried you benchmark at work ( win7, plenty of ram and a beefy cpu ) and get the following:

    * 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.
added on the 2012-08-09 10:55:06 by p01 p01
@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
added on the 2012-08-09 20:00:29 by Tigrou Tigrou
SUKKZ!

login