Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0

Wednesday 19 March 2014

Time to embrace jdk1.8.0 for ruby-processing (don't try this with vanilla processing).

There are performance improvements to be had if you switch to using jdk8 with ruby-processing, if you are a jEdit user it is dead simple just modify the bsh macro (gist below) to suit your system. While you are at it you can experiment with ruby-2.0 syntax (current default is ruby-1.9.3 with jruby). Check it with esefera.rb (starts of at moderate speed, even slows down briefly but the picks up again as the optimizations kick in). See below or gist (embedded gist looked crap).
// rp5.bsh
//setenv("JAVA_HOME", "/opt/jdk1.7.0_51");
setenv("JAVA_HOME", "/opt/jdk1.8.0");
setenv("GEM_HOME", "/home/tux/.gem/ruby/2.1.0");
setenv("GEM_PATH", "/home/tux/.gem/ruby/2.1.0");
new console.commando.CommandoDialog(view,"commando.rp5");


<!-- rp5.xml monkstone, 2013-August-16 for ruby-processing > 2.0.12 -->
<COMMANDO>
<UI>
<CAPTION LABEL="Run">
<FILE_ENTRY LABEL="ruby file" VARNAME="file" EVAL="buffer.getName()"/>
</CAPTION>
<CAPTION LABEL="Path to rp5">
<ENTRY LABEL="path" VARNAME="rp5path" DEFAULT=""/>
</CAPTION>
<CAPTION LABEL="Choose Run/Watch/Create/App">
<CHOICE LABEL="Select" VARNAME="type" DEFAULT="run" >
<OPTION  LABEL="run" VALUE="run"/>
<OPTION LABEL="watch" VALUE="watch"/>
<OPTION LABEL="create" VALUE="create"/>
<OPTION LABEL="export app" VALUE="app"/>
<OPTION 
</CHOICE>
</CAPTION>
<CAPTION LABEL="JRuby Opt">
<TOGGLE LABEL="jruby-complete" VARNAME="jruby" DEFAULT="FALSE"/>
</CAPTION>
</UI>

<COMMANDS>

<COMMAND SHELL="System" CONFIRM="FALSE">
<!-- cd to working dir -->

   buf = new StringBuilder("cd ");
   buf.append(MiscUtilities.getParentOfPath(buffer.getPath()));
   buf.toString();

</COMMAND>



<COMMAND SHELL="System" CONFIRM="FALSE">

   buf = new StringBuilder(rp5path);
   buf.append("rp5 ");
   if (jruby){
   buf.append("--nojruby ");
   }
   buf.append(type);
   buf.append(" ");
   switch(type){
   case "run":
   case "watch":
       buf.append(file);
       break;
   }
   buf.toString();

</COMMAND>


</COMMANDS>
</COMMANDO>

F.P.S esfera.rb
framejdk7jdk8
303.282163.78027
603.749404.49563
904.433146.03558
1204.287476.36669
1504.323806.30815
1804.297456.16097
2104.322816.37150

The above table was generated by capturing fps at 30 frame intervals (so is not entirely fair), and what you don't see cf watching the sketch running live, is a slightly faster start, followed by a pronounced slowdown (presumably when the optimization kicks in). Following a bit of experimentation best results were obtained with -XX:+TieredCompilation option alone 7+ fps with jdk8.

No comments:

Post a Comment

Followers

Blog Archive

About Me

My photo
I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2