From: Logan Capaldo Date: 2006-02-24T08:20:56+09:00 Subject: Re: Launching Ruby scripts and the future of MVM On Feb 23, 2006, at 5:42 PM, gwtmp01@mac.com wrote: > > On Feb 23, 2006, at 5:05 PM, Charles O Nutter wrote: >> I tossed this message off to the Ruby-core list about a month ago, >> and >> sent a follow-up email today. The basic idea is that if there were a >> Kernel#run_script method or similar, all Ruby apps that want to >> launch >> external scripts could do so in a platform and >> implementation-independent way. > > In what way is what you are proposing different from Kernel#system? > > Gary Wright > > > > system(x) # x is arbitrary shell command run_script(x) # x is guaranteed to be a script written in ruby This means for instance, that run_script could get away with not forking a new process, but rather just a new ruby VM assuming that the ruby implementation had that capability In the OPs example, using system to run another ruby script is going to cause a whole new JVM to be created, along with the overhead of a new ruby interpreter. Apparently JRuby has the ability to have multiple instances of ruby per process. By incorporating this method into ruby, scripts that want to run other ruby scripts can run faster than they do currently (and no slower). In the C implementation of ruby of course run_script could easily be implemented in terms of system, but the JRuby guys would be able to implement it in a more performant manner for their situation. Likewise YARV could theoretically create a new instance of itself instead of a whole nother process.