SysOutNull (bpfurtado) wrote,

Design the Language and receive the best 'dna' traits at its birth

I've posted a few entries based on this article about Graal & Truffle, here are some highlights of this article:

Truffle is a framework for writing interpreters with annotations and small bits of extra code in them which, when Truffle is paired with its sister project Graal, allow those interpreters to be converted into JIT compiling VMs … automatically. The resulting runtimes have peak performance competitive with the best hand-tuned language-specific compilers on the market. For example, the TruffleJS engine which implements JavaScript is competitive with V8 in benchmarks. The RubyTruffle engine is faster than all other Ruby implementations by far. The TruffleC engine is roughly competitive with GCC.

This project could advance an order of grandess the quick experimentation|variability and consequent evolution of new programming languages|platforms. The modern state of the art characteristics of successful programming languages are given without effort to those willing to work with this toolset, which is already showing the remarkable results cited in the excerpt above.

Graal is designed from the start as a multi-language compiler, but its set of optimization techniques is especially well suited to compiling programs with high levels of abstraction and dynamism. It runs Java as fast as the existing JVM compilers do, but when applied to Scala programs it runs them about 20% faster. Ruby programs get 400% faster than the best alternative runtime (i.e. not MRI)."

Some notable languages already experimented with are:

  • Smalltalk;

  • LLVM bitcode, allowing C/C++/Objective-C/Swift programs to run on it;

  • Python 3 (yes, 3);

  • R;

  • Lua (Lua can get 'for free' a state of the art VM... awesome);

Mike Hearn also reminds us that:

To give a feel for how easy it is to write these engines, TruffleJS is only about 80,000 lines of code compared to about 1.7 million for V8.

80k to 1.7mi? That is a gap... and we can thank Oracle Labs for that, and they say:

Graal is a new just-in-time compiler for the JVM, written in Java and focused on performance and language interoperability. Graal offers performance advantages to Java code, thanks to new techniques of method inlining, eliding object allocations and speculative execution - and makes possible high-performance scripting language engines.

Fast scripting languages, this is addressing one of the most common flaws of languages of this nature, one that has become the most popular in the past years.
Tags: graal_truffle, jvm, oracle, programming_language

  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.