Search code examples
javascriptingrhinobeanshell

Fastest scripting language for Java?


I'm making a falling sand game in Java. I want users to be able to write their own engine for the game and I thought a scripting language might work for that. I've tried out a small script with jython and it's many times slower than that java version.

I need a scripting language that has fast loops and/or fast array access since that's what the game will be doing a lot of. Or if you have any suggestions on another way to let users write their own engine for the game.

I'm also not entirely sure this can work (well). If you don't think it can please let me know why and maybe some possible alternatives.


Solution

  • JavaCC

    You could write you're own simple game language with JavaCC. This does give's you all the flexibily you possibly want and native Java speed (well that actualy depends on you're implementation). But you need to keep you're syntax simple or else it will take some efford...

    Java

    Java? Yes Java! Why not let users extend you're game by Java code? In Java 6 there is a Java compiler API:

    Beanshell vs Rhino

    Some performace comparison between BeanShell and the Rhino (Javascript) interpreters (Rhino is the winner):