java graal.js interop
Thomas Wuerthinger
thomas.wuerthinger at oracle.com
Sun Dec 10 22:18:40 UTC 2017
Adam,
We will soon introduce extra user group mailing lists. For now, feel free to discuss here ;).
Please share your micro tests so we can verify results.
Thanks, thomas
> On 10 Dec 2017, at 22:21, Adam McMahon <adam at cs.miami.edu> wrote:
>
> Hi Boris,
>
> [1] Yes, you are completely correct and that is what I observed with regard
> to performance. Though in my silly little micro test, Nashorn (warmed up)
> beat both graal-SVM and graal-JVM. Now I think I have a better idea how
> Graal.js works inside or outside of JVM.
>
> [2] User group? Do you think there is enough interest in GraalVM to
> create a user group (perhaps a goolge group?) I would enjoy discussing
> GraalVM: pros/cons and use cases, but do not want to clutter the dev group.
> thoughts?
>
> -Adam
>
> On Sun, Dec 10, 2017 at 4:39 AM, boris.spasojevic <
> boris.spasojevic at oracle.com> wrote:
>
>> Hey Adam,
>>
>> Running with --jvm means that the js code is also executed on the JVM.
>> Running js on the JVM requires substantially longer warm-up time than
>> running on SVM but yields better peek performance. I'm assuming that your
>> example just isn't running long enough to get the full benefits of the JVM.
>>
>>
>>
>> Sent from my Samsung Galaxy smartphone.
>>
>> -------- Original message --------
>> From: Adam McMahon <adam at cs.miami.edu>
>> Date: 12/10/17 09:46 (GMT+01:00)
>> To: "boris.spasojevic" <boris.spasojevic at oracle.com>
>> Cc: graal-dev at openjdk.java.net
>> Subject: Re: java graal.js interop
>>
>> Hi Boris,
>>
>> Thanks for the heads-up, that works well with the --jvm option.
>>
>> However, when I add the --jvm option, I noticed that pure JS code ran much
>> slower (not just a slower startup, which was expected, but slower execution
>> of pure JS). I can provide an example, if needed, but this was unexpected
>> to me as an end user. --polyglot did not slow down the JS execution.
>>
>> it seems odd to me that just including the JVM as an option would slow
>> down the Graal.js execution of pure JS.
>>
>> -Adam
>>
>>
>>
>> On Sun, Dec 10, 2017 at 2:24 AM, boris.spasojevic <
>> boris.spasojevic at oracle.com> wrote:
>>
>>> Hey Adam,
>>>
>>> I am also unsure if this is the best place to answer user questions about
>>> Graal.js but here goes :)
>>>
>>> Without going into to much detail, js executes on SVM by default. You
>>> need to run js with --jvm in order to execute on the JVM and have access to
>>> Java.
>>> So: "js --jvm myscript.js"
>>>
>>> If you need access to the other truffle languages add --polyglot.
>>> "js --polyglot myscript.js" which will run on SVM with polyglot enabled.
>>> If you want Java + other languages just add both:
>>> "js --jvm --polyglot myscript.js"
>>>
>>> Hope that helps.
>>>
>>> Sent from my Samsung Galaxy smartphone.
>>>
>>> -------- Original message --------
>>> From: Adam McMahon <adam at cs.miami.edu>
>>> Date: 12/10/17 02:27 (GMT+01:00)
>>> To: graal-dev at openjdk.java.net
>>> Subject: java graal.js interop
>>>
>>> Hi,
>>>
>>> I am unsure if this is the best place to post user questions about
>>> Graal.js,
>>>
>>> I am not able to get the JS examples working that use Java. I get the
>>> following error:
>>>
>>> ReferenceError: Java is not defined
>>>
>>> It seems that Java.type(String), is not defined. I am running Graal.js by
>>> using "js myscript.js" on Ubuntu 16, graalvm-0.30.
>>>
>>> Best,
>>>
>>> -Adam M.
>>>
>>
>>
More information about the graal-dev
mailing list