I'd heard of HotRuby before but thought it was merely a browser-based Ruby interpreter written in JavaScript. A second look at it, via John Resig's post yesterday brought this to the fore:
- Script finds <script type="text/ruby"></script> tags and extracts the inline Ruby code from them.
- The Ruby code is sent to the server via an XMLHttpRequest.
- The server-side CGI script (in Ruby, using Ruby 1.9) compiles the incoming Ruby into its associated opcodes and serializes it into a JSON data structure.
- The browser consumes the opcodes, translating it into JavaScript, and executes it.
Interesting, and according to John's post, this round-about approach still shows pretty impressive performance benchmarks.
To look at it from another perspective, we can also do browser-based Ruby with Silverlight, in the upcoming version 2 anyway. This would be managed Ruby code running on Silverlight's DLR, all on the (plugin-enabled) browser, without the round-trip that the HotRuby approach requires. I wonder how the performance benchmarks for such an approach, and how it stacks up against HotRuby.
0 comments:
Post a Comment