Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm not entirely sure what you're asking, so I'll split it in two parts and hope one of them is applicable.

> With Truffle i can get whatever prog lang abd compile it with Graal and either use with Graal VM or Substrate VM.

Truffle is basically a toolkit for building language runtimes. It provides a framework for creating AST interpreters. Generally AST interpreters are easy to work with and reason about, but slow. Truffle addresses the speed issue by using Graal's API to perform partial evaluation on the interpreter. So, you get very fast runtimes without having to build a custom VM. But, it also exposes some compiler details by way of an annotation-based DSL if you want to take advantage of it. This includes control for PIC sizes, loop exploding, and explicit branch profiling amongst others.

As a language toolkit, Truffle also gives you an instrumentation framework so you get things like a debugger and profiler for minimal effort. It provides a polyglot system so you can call into other Truffle languages. Since they all inherit from the same base Node class, the compiler can even inline nodes across language boundaries. Truffle takes advantage of that itself by shipping functionality, such as its own native function interface, as its own Truffle language.

> And i get what ? an executable which includes only what the program needs / uses ?

The SVM can be used to compile any Java program. Truffle-based language implementations are just Java programs. Compiling with the SVM allows you to build a statically linked native binary that contains your language runtime. Generally that binary will have improved startup time, ease distribution issues, and so on. The SVM links in Graal, so you get all that without sacrificing peak performance.



Thanks for the thorough explanation. I am curious how hard / time consuming is to reimplement the existing languages in Truffle.


> I am curious how hard / time consuming is to reimplement the existing languages in Truffle.

We focus on getting really high performance from our Truffle languages, so we often forget to emphasise this point: Truffle is the easy way to create languages, as well as the high performance way. Truffle uses the AST pattern, which is how an undergraduate would implement an interpreter after one compilers course. And you can get 90% of the high performance from a simple interpreter, and then work on it a bit more to get the remaining 10% when you find you need it.


At this stage how usable is all of this (graal/truffle etc) in real production ?


Twitter are using Graal in production right now and say it’s saving them real money. Truffle’s a bit earlier in development still.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: