TruffleInteropUsability

From APIDesign

Revision as of 10:05, 13 June 2016 by JaroslavTulach (Talk | contribs)
Jump to: navigation, search

Please use README at https://github.com/graalvm/truffle as your starting point.

Contents

1. Setting Up

Download GraalVM, setup your IDE to allow you to develop against Truffle API. Write a main class that initializes the Truffle interpreter and evaluetes 'Hello World!' application in JavaScript, Ruby, R and one more language with Truffle interpreter. Package the application as a JAR file and execute it from a command line: java -cp yourapp.jar yourpkg.app.MainClass (or something like this).

2. Compare the Speed

Implement some well known algorithm in JS, Ruby, R and compare speed of the execution in GraalVM JS vs. regular JS, in Graal Ruby and regular Ruby and/or in GraalVM R and normal R. Find good examples in different languages here: http://benchmarksgame.alioth.debian.org Make sure the algorithm is warmed up - let it run for few seconds, repeat the computation few times to give the system time to optimize. Compare the speed of initial vs. optimized execution.

3. Java Interoperability

Re-implement inner part of your algorithm in Java. Use interoperability features of Truffle API to communicate between the scripting language and Java. Does the rewrite to Java influence the execution speed of your algorithm?

4. Expose Java Data

Expose a Java class like Address that has name, street, town, zipcode fields as an object usable from the Truffle languages. Write a program that constructs the Address instance in Java and passes it into a function written in Ruby/JavaScript/R and this function reads the fields from the object concatenates them into a sequence: {name} lives at {street} in {town} and returns it.

5. Write a Unit Test

Verify the Address concatenating algorithm by writing a unit test using JUnit. Execute it successfully.

Post-study questions (up to 5)

  • How well the Truffle system fits into your developer workflow? What are the three most important issues that could make your experience better?
  • Name at least three of the most difficult problems you encountered during task execution.
  • Have you experienced any unexpected crashes or errors? If yes, did you find the error messages useful?
  • Name at least three ways we can improve the documentation.
  • Name at least three ways we can make the API easier to use (other than documentation).

What is a development stage of your API?

Technology preview.

Personal tools
buy