Nashorn (Comments)https://blogs.oracle.com/nashorn/feed/comments/atom2015-08-02T13:47:17+00:00Apache Rollerhttps://blogs.oracle.com/nashorn/entry/porting_from_the_browser_to#comment-1430333333129Re: Porting from the Browser to Nashorn/JavaFX (Part I)Rodrigo2015-04-29T18:48:53+00:002015-04-29T18:48:53+00:00
<p>I&acute;m now stuck on the same ChangeListener error as above. Where do I add the load methods? I tried to add the load methods in the adapter.js file, but it doesn&acute;t work. It, of course, it doesn&acute;t work if I try to add it on the java file. In java should it be an import &lt;something&gt;?</p>
https://blogs.oracle.com/nashorn/entry/porting_from_the_browser_to#comment-1430248756292Re: Porting from the Browser to Nashorn/JavaFX (Part I)jlaskey2015-04-28T19:19:16+00:002015-04-28T19:19:16+00:00
<p>I think I need more explanation of what you are trying to do.</p>
https://blogs.oracle.com/nashorn/entry/porting_from_the_browser_to#comment-1430247677670Re: Porting from the Browser to Nashorn/JavaFX (Part I)guest2015-04-28T19:01:17+00:002015-04-28T19:01:17+00:00
<p>I&acute;m trying to run your code, but directly trhough Java and not jjs. I got example1 and example2 to work fine, but I don&acute;t know how to create a WebViewWrapper in Java. How do I load the adapter.js file in java and call it?</p>
<p>Thanks,</p>
<p>Rodrigo</p>
https://blogs.oracle.com/nashorn/entry/nashorn_multi_threading_and_mt#comment-1428899374732Re: Nashorn Multithreading and MT-safetyMark A. Ziesemer2015-04-13T04:29:34+00:002015-04-13T04:29:34+00:00
<p>Simple fix here (at least for the simple example):</p>
<p>Replace:<br/>
onePlusOne.eval();</p>
<p>With:<br/>
onePlusOne.eval(new SimpleBindings());</p>
<p>Or, for a slighter more comprehensive approach:<br/>
onePlusOne.eval(new SimpleScriptContext());</p>
<p>Granted, once situations are involved that require sharing of state between threads, things get more complicated - but please note that for simple cases where things need to be completely isolated anyway, the above will suffice.</p>
https://blogs.oracle.com/nashorn/entry/nashorn_performance_work_in_the#comment-1421866429900Re: Nashorn Architecture and Performance Improvements in the Upcoming JDK 8u40 ReleaseMartin2015-01-21T18:53:49+00:002015-01-21T18:53:49+00:00
<p>&quot;Nashorn TypeScript is still not open sourced, but we hope we have the chance to do it soon.&quot;<br/>
---<br/>
Wow, never thought that there is s.th. like this in the works. We invest heavily into TypeScript, and so far, its the best way to write secure and maintainable &quot;JS&quot; code. This becomes a matter if you have large code bases. Our current solution using the TS transpiler feels bumpy, so I'm looking forward to the TS support in Nashorn. Thanks.</p>
https://blogs.oracle.com/nashorn/entry/using_nashorn_with_intellij#comment-1420821991347Re: Using Nashorn with IntelliJguest2015-01-09T16:46:31+00:002015-01-09T16:46:31+00:00
<p>There seems to be an error in the title, because this post is about Netbeans, not Intellij. Or am I missing something?</p>
https://blogs.oracle.com/nashorn/entry/nashorn_performance_work_in_the#comment-1420645696842Re: Nashorn Architecture and Performance Improvements in the Upcoming JDK 8u40 ReleaseGuest2015-01-07T15:48:16+00:002015-01-07T15:48:16+00:00
<p>Very interesting - hadn't realized that the Nashorn work was not just JS specific.</p>
<p>It feels like the Dart language would be a good target for an additional language.</p>
<p>Then I'd get the best of both worlds - the world class server VM with world class broad and deep libraries ( inbuilt and third party ), and a single decent ( not current JS - sorry ) language that works both on the web client and the server.</p>
<p>If Google can co-opt Java for Android, I don't see why Oracle can't co-opt Dart :-)</p>
<p>It also would be interesting to see a comparison of the Dart language VM speed versus this approach as I believe Dart VM doesn't actually use the optional type information.</p>
https://blogs.oracle.com/nashorn/entry/nashorn_multi_threading_and_mt#comment-1420558833572Re: Nashorn Multithreading and MT-safetyjlaskey2015-01-06T15:40:33+00:002015-01-06T15:40:33+00:00
<p>What Attila was stating (and information may be dated, not recently checked) was that you can update Nashorn objects concurrently (no crashes), but there are no guarantees of outcome. x.a = 10; on one thread and x.b = 20; on another may or may not result in x having an &quot;a&quot; AND a &quot;b&quot;.</p>
<p>The rules described in this article will hold indefinitely. At some point in the future, changes to allow concurrent updating.</p>
https://blogs.oracle.com/nashorn/entry/nashorn_multi_threading_and_mt#comment-1420558255861Re: Nashorn Multithreading and MT-safetyMarat Gainullin2015-01-06T15:30:55+00:002015-01-06T15:30:55+00:00
<p>It seems, that some misunderstood happend. Attila have wrote in OpenJDK mailing list (<a href="http://mail.openjdk.java.net/pipermail/nashorn-dev/2013-July/001567.html)," rel="nofollow">http://mail.openjdk.java.net/pipermail/nashorn-dev/2013-July/001567.html),</a> that internal structures of library nashorn are thread safe, but javascript programs are not. Is it true? And what if somebody will execute scripts concurrently in the same Global and the same engine. Will the Global scope object itself(not global variables) been destroyed because of concurrently loading scripts, thus concurrently modifying Global's internal structures (propertyMaps, etc)?</p>
https://blogs.oracle.com/nashorn/entry/nashorn_multi_threading_and_mt#comment-1420483280472Re: Nashorn Multithreading and MT-safetyjlaskey2015-01-05T18:41:20+00:002015-01-05T18:41:20+00:00
<p>The global object is never thread safe. It's trivially easy to create a new global (missing 'var'). That is why we recommend the use of loadWithNewGlobal per thread. However, you can define a shared AtomicReference that would always be read ready across all threads.</p>
https://blogs.oracle.com/nashorn/entry/nashorn_multi_threading_and_mt#comment-1420482684035Re: Nashorn Multithreading and MT-safetyMarat Gainullin2015-01-05T18:31:24+00:002015-01-05T18:31:24+00:00
<p>Ii is considered, that executing new scripts puts some new content into global object (global variables and functions), thus reorganizing it's internal structure. And that is why calls of already executed scripts should be synchronized with executing of new ones. Previous posts, talking about &quot;go&quot; function push me to think about global object reorganization process as of thread-safe already. Because otherwise it will be incorrect to talk about eventually removing of &quot;go&quot; function at all. If global object internal structure is not thread-safe, than any MT manlpulations on a global object is harmful (even executing new scripts). Is it correct? </p>
https://blogs.oracle.com/nashorn/entry/nashorn_multi_threading_and_mt#comment-1420462016945Re: Nashorn Multithreading and MT-safetyjlaskey2015-01-05T12:46:56+00:002015-01-05T12:46:56+00:00
<p>The main issue with a global lock is performance. Having all your threads contending with a global lock will eventually bite you. It would be better to use AtomicReference <a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/package-summary.html." rel="nofollow">http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/package-summary.html.</a> </p>
https://blogs.oracle.com/nashorn/entry/nashorn_multi_threading_and_mt#comment-1420199799472Re: Nashorn Multithreading and MT-safetyMarat Gainullin2015-01-02T11:56:39+00:002015-01-02T11:56:39+00:00
<p>How do you think, if one whants to use JVM multithreading in Nashorn, can he use read-write lock to execute new scripts in write locked code block and to execute old scripts in read locked code blocks againsted the same global object? It's considered that read locked code blocks will be run rapidly and write locked code blocks will be run from time to time. Is it effective strategy for isolation of modifying global object process from processes that use it only for read? To guarantee read only use of global, one chould be able to freeze global and then after holding of write lock unfreeze it to freeze it again later. It seems, that it is impossible, but i am very interested in your comments about such approach.</p>
https://blogs.oracle.com/nashorn/entry/repost_a_simple_real_time#comment-1420039613098Re: Repost: A simple Real-time Web App built with Nashorn Scriptingguest2014-12-31T15:26:53+00:002014-12-31T15:26:53+00:00
<p>Nashorn is cool.</p>
https://blogs.oracle.com/nashorn/entry/nashorn_performance_work_in_the#comment-1418923658278Re: Nashorn Architecture and Performance Improvements in the Upcoming JDK 8u40 ReleasePete2014-12-18T17:27:38+00:002014-12-18T17:27:38+00:00
<p>How does this approach compare/overlap with Project Graal and Truffle?</p>
<p>Just curious as naively the descriptions of the optimizations present in Nashorn 8u40 seem similar to Project Graal (or more specifically Truffle).</p>
<p>You talk of Nashorn becoming a 'LLVM for dynamic languages on the JVM', JRuby currently has a Graal/Truffle enabled implementation:</p>
<p><a href="https://github.com/jruby/jruby/wiki/Truffle" rel="nofollow">https://github.com/jruby/jruby/wiki/Truffle</a></p>
<p>My naive understanding is that Graal is a JIT compiler implemented in Java (i.e. not presently in JDK 8 or likely to be in JDK 9, and so not available to Nashorn), Truffle requires this Graal enabled VM and seems to be where the greatest possible overlaps with Nashorns LLVM aspirations lie.</p>
https://blogs.oracle.com/nashorn/entry/nashorn_performance_work_in_the#comment-1418824626392Re: Nashorn Architecture and Performance Improvements in the Upcoming JDK 8u40 ReleaseMatt2014-12-17T13:57:06+00:002014-12-17T13:57:06+00:00
<p>Exciting stuff! Are these improvements included in 8u40 Build b18?</p>
https://blogs.oracle.com/nashorn/entry/nashorn_performance_work_in_the#comment-1418809881340Re: Nashorn Architecture and Performance Improvements in the Upcoming JDK 8u40 Releaseguest2014-12-17T09:51:21+00:002014-12-17T09:51:21+00:00
<p>V8 directly compiles to native code. Nashorn has an additional first step by generating bytecode first. How costly is creating bytecode first compared to the V8 compiler?</p>
https://blogs.oracle.com/nashorn/entry/nashorn_performance_work_in_the#comment-1418800012296Re: Nashorn Architecture and Performance Improvements in the Upcoming JDK 8u40 ReleaseAnirvan2014-12-17T07:06:52+00:002014-12-17T07:06:52+00:00
<p>Nice work !!</p>
<p>P.S. The is a broken image link before this statement: &quot;To run Nashorn with 8u40 and optimistic types, use the argument --optimistic-types=true&quot;</p>
https://blogs.oracle.com/nashorn/entry/nashorn_performance_work_in_the#comment-1418738513218Re: Nashorn Architecture and Performance Improvements in the Upcoming JDK 8u40 Releaselagergren2014-12-16T14:01:53+00:002014-12-16T14:01:53+00:00
<p>Jay - we are not exposing the continuations right now, but we really do want to create a multilanguage platform out of this, so hopefully this is the direction we are going for 9 and the future.</p>
https://blogs.oracle.com/nashorn/entry/nashorn_performance_work_in_the#comment-1418738335907Re: Nashorn Architecture and Performance Improvements in the Upcoming JDK 8u40 ReleasePietro Braione2014-12-16T13:58:55+00:002014-12-16T13:58:55+00:00
<p>How does Nashorn compare with Truffle/JS?</p>
https://blogs.oracle.com/nashorn/entry/popularity_of_nashorn#comment-1418736263690Re: Popularity of Nashornjlaskey2014-12-16T13:24:23+00:002014-12-16T13:24:23+00:00
<p>Nashorn continues to improve performance. 8u40 will include compiled code caching and better optimization. Next up will be improvements for small scripts (evals.)</p>
https://blogs.oracle.com/nashorn/entry/nashorn_performance_work_in_the#comment-1418736106493Re: Nashorn Architecture and Performance Improvements in the Upcoming JDK 8u40 Releasejlaskey2014-12-16T13:21:46+00:002014-12-16T13:21:46+00:00
<p>Continuations will be exposed in the ES6 work for JDK 9.</p>
https://blogs.oracle.com/nashorn/entry/porting_from_the_browser_to#comment-1418736053426Re: Porting from the Browser to Nashorn/JavaFX (Part I)jlaskey2014-12-16T13:20:53+00:002014-12-16T13:20:53+00:00
<p>It's declared in web.js. In this example I used;</p>
<p>load(&quot;fx:base.js&quot;);<br/>
load(&quot;fx:controls.js&quot;);<br/>
load(&quot;fx:graphics.js&quot;);<br/>
load(&quot;fx:web.js&quot;);</p>
https://blogs.oracle.com/nashorn/entry/porting_from_the_browser_to#comment-1418727459905Re: Porting from the Browser to Nashorn/JavaFX (Part I)guest2014-12-16T10:57:39+00:002014-12-16T10:57:39+00:00
<p>Running the last version of the code I get a</p>
<p> ReferenceError: &quot;ChangeListener&quot; is not defined</p>
<p>What is missing?</p>
https://blogs.oracle.com/nashorn/entry/nashorn_performance_work_in_the#comment-1418494879298Re: Nashorn Architecture and Performance Improvements in the Upcoming JDK 8u40 Releasejay2014-12-13T18:21:19+00:002014-12-13T18:21:19+00:00
<p>is the API to the continuations feature accessible? and how simple is simple? will it be documented upon release?</p>
<p>that single sentence tickled me greatly, I make heavy use of rhino continuations but I would love to have an upgrade path into nashorn.</p>
https://blogs.oracle.com/nashorn/entry/nashorn_performance_work_in_the#comment-1418480603705Re: Nashorn Architecture and Performance Improvements in the Upcoming JDK 8u40 ReleaseBrett Wooldridge2014-12-13T14:23:23+00:002014-12-13T14:23:23+00:00
<p>Great work guys! We are just starting to leverage Nashorn, and this great news to us.</p>
https://blogs.oracle.com/nashorn/entry/nashorn_performance_work_in_the#comment-1418432587078Re: Nashorn Architecture and Performance Improvements in the Upcoming JDK 8u40 ReleaseRubin2014-12-13T01:03:07+00:002014-12-13T01:03:07+00:00
<p>Good work! Congratulations. Impressive benchmark scores.</p>
<p>Is there any chance some of those optimizations will eventually contribute to the excellent Bck2Brwsr or DoppioJVM projects? Do you know if there's any ongoing effort within Oracle to create a JVM in Javascript, for a true plugin-less Java experience in the browsers? (I know that's only indirectly related to this article.)</p>
<p>I don't know a better solution to reach the sprawling client base - Android, iOS, Winphone etc., none of which have a true java implementation.</p>
<p>Thanks!</p>
https://blogs.oracle.com/nashorn/entry/popularity_of_nashorn#comment-1411561913890Re: Popularity of Nashornguest2014-09-24T12:31:53+00:002014-09-24T12:31:53+00:00
<p>Hi, <br/>
I've compared execution speed of <br/>
Rhino(JDK7u45) <br/>
Nashorn(JDK8u40b6) <br/>
Jython(v2.5.3) </p>
<p>The outcome of using <br/>
- 1 scriptingengine instance <br/>
- 200 CompiledScript objects, each their own SimpleContext, each executing only once <br/>
- all executing in seperate Swingworker instances(i.e. max 10 threads) <br/>
is listed below, as 'total execution duration' : <br/>
* Jython #1 at 152 msec <br/>
* Rhino #2 at 219 msec <br/>
* Nashorn at 13600 msec </p>
<p>When repeatedly running the compiledScript objects(all, every 500 msec), i found that only after about 1 minute, the Nashorn engine has compiled&amp;classloaded all scripts, after which it runs at comparable speeds.</p>
<p>I've posted on nashorn.dev.java.net, but there seems to be close to no-one able to comment on this slowness issue.</p>
<p>Currently, since the seperately provided Rhino(as per &quot;OpenJDK - Using Rhino JSR-223 engine with JDK8&quot;) is running about 160x slower than the JDK7u45-built-in one, i'm almost forced to use the Jython engine.</p>
<p>I'm hoping you can help me in gettng more out of Nashorn</p>
<p>Kind regards,<br/>
Roland</p>
https://blogs.oracle.com/nashorn/entry/latest_news_from_the_nashorn#comment-1410780192948Re: Latest news from the Nashorn teamjlaskey2014-09-15T11:23:12+00:002014-09-15T11:23:12+00:00
<p>Documentation will come with the release. In the mean time <br/>
--persistent-code-cache=true and --class-cache-size=50 are the two main options <br/>
for managing the code cache. The cache is off by default to get better startup <br/>
performance for run once scripts.</p>
https://blogs.oracle.com/nashorn/entry/latest_news_from_the_nashorn#comment-1410459370277Re: Latest news from the Nashorn teamguest2014-09-11T18:16:10+00:002014-09-11T18:16:10+00:00
<p>Is there documentation on how to take advantage of the caching enhancement?</p>