4 ms·
Running Optcarrot, a Ruby NES Emulator, at 150 Fps with the GUI
- claudiug 10y agocan we predict that jruby+truffle, will be usable for ruby gems in the next few years?
- qwertyuiop924 10y agoNo, no we can't. Or at least, I doubt it. You're free to predict whatever you like. At the very least, I don't think any amb implementations are making their way to jruby any time soon. Although that's not an issue with any real-world code.
- MrBra 10y agoWhat's amb?
- qwertyuiop924 10y agoamb is a nondeterministic operator. It's a fun toy, although not terribly practical. It's usually implemented in terms of call/cc, a rare (and, as commonly implemented, expensive) function. CRuby implements it, JRuby doesn't. It's not revelant to my main point, but I thought I'd have a bit of fun.
- eregon 10y agoActually, JRuby+Truffle can already install gems using Bundler, although it uses some hacks to work around issues like currently-missing OpenSSL. Realistic Rails apps will not work yet, but there is fast progress in this area, we started this year with a minimal webserver and now got a simple blog app working with a PostgreSQL adapter.
- tbrock 10y agoHow does truffle enhance JRuby to create such a dramatic performance improvement?
- chrisseaton 10y agoTruffle uses Graal, a new JIT compiler for the JVM written in Java. As it's written in Java, it can be used like a library - directly calling methods to compile exactly what you want, exactly how you want. Truffle uses this to compile your Ruby program using partial evaluation, a technique which is really good at removing the kind of overhead that the JVM usually adds, like costs for allocation. This blog post and video explain where a lot of the big speedups come from. http://chrisseaton.com/rubytruffle/deoptimizing/ http://chrisseaton.com/rubytruffle/deoptimizing/ I wrote my PhD about this topic, so there is even a whole thesis if you really want to get the details on how it works. http://chrisseaton.com/phd/ http://chrisseaton.com/phd/
- spoiler 10y agoEDIT: The man himself made a post: https://news.ycombinator.com/item?id=13058481 https://news.ycombinator.com/item?id=13058481 I wish it could be summarised in a comment, but it's actually not "that simple," so I recommend you read Chris Seaton's posts about GraalVM and JRuby+Truffle which has some excellent high-level explanations [of why Graal is amazing]. :) http://chrisseaton.com/rubytruffle/ http://chrisseaton.com/rubytruffle/
- deleted 10y ago[deleted]
- Retr0spectrum 10y agoI was intrigued by the method of piping pixel values to MPlayer as a frontend. I'll definitely be using that in future projects. It makes use of this video format, which seems almost like a video equivalent of the PNM image format: https://wiki.multimedia.cx/index.php?title=YUV4MPEG2 https://wiki.multimedia.cx/index.php?title=YUV4MPEG2 I wish there was something similar that used RGB though.
- kayamon 10y agoWhile it's interesting how you can accelerate Ruby, 150 fps is still _awful_ for a NES emulator on modern platforms. It kinda shows how bad Ruby's performance is compared to most other languages.
- eregon 10y agoOn the other hand, I am confident it's written in a much nicer way than most NES emulators (look at cpu.rb/ppu.rb). The goal of optcarrot is explicitly not to be the "practical"or "the fastest NES emulator". From https://github.com/mame/optcarrot https://github.com/mame/optcarrot > NOTE: We do not aim to create a practical NES emulator. There have been already many great emulators available. We recommend you use another emulator if you just want to play a game. JRuby+Truffle's performance is not bad compared to other languages: https://github.com/smarr/are-we-fast-yet#current-status https://github.com/smarr/are-we-fast-yet#current-status