Stack update + Nashorn readiness

33 views
Skip to first unread message

Tal Liron

unread,
Oct 16, 2013, 7:08:20 AM10/16/13
to prudence-...@googlegroups.com
Big update to all products in the stack.

NASHORN READINESS

The entire stack can now run on Nashorn, instead of Rhino. You will need JDK 8 build above 111 for this to work (111 and earlier have showstopping bugs). Note that such a build is not yet available at the time of writing this email, but you can build Nashorn from source to get the required fixes right now if you wish.

To use Nashorn instead of Rhino in Sincerity, set the appropriate environment vars. Something like this would work in *nix:

JAVA_HOME=/usr/lib/jvm/jdk1.8.0 SINCERITY_JAVASCRIPT=Nashorn sincerity

Everything in the stack should work: Sincerity, Prudence, Diligence, MongoVision, Scripturian, as well as all the plugins. However, this support is still considered experimental, due to Nashorn still being under heavy development, and us not doing enough testing for all features. Still, when JVM 8 gets officially released in March 2014, everything should just work.

This was quite a lot of work on my end, but also by the Nashorn team who implemented fixes and new features. I'd like to especially thank the project lead, Jim Laskey, as well as Attila Szegedi, for patiently reading my many bug reports and accepting a few of my suggestions for improvement.

What does this mean for you? Not much right now, unless you want to help us with testing on Nashorn! But later on, Nashorn promises signficant performance improvements over Rhino, although in its first release it will miss one feature important for Sincerity's performance: Nashorn cannot cache compiled files to disk (although it does cache in RAM). Because of this, and because Nashorn generally compiles slower than Rhino, boostrapping is in total a bit slower for Nashorn compared to Rhino. However, for the actual running servers, performance should be as much as three times better, with mileage varying.

An indirect benefit, too, was that bugs in Nashorn required me to add more robustness to various parts of the stack. :)

I'll explain more specifics in the rest of this email, as well as other new features in these builds.

SCRIPTURIAN 1.0.10
  • New exposed API: document.require. This works just like document.executeOnce, but can accept an array of document names to load. This allows for cleaner and more readable code. The entire stack has been updated to use it.
  • New "debug" flag in ParsingContext: outputs the source for scriptlets to "/cache/scripturian/". In Prudence, this is enabled when you set debug mode to true in settings.js. This can go a long way to help debug broken scriptlets.
  • Fully working Nashorn adapter
  • A bug fix for in-thread executions (Sincerity and Prudence had to also be modified a bit for a new API)
SINCERITY 1.0-dev17
  • New API: Sincerity.Objects.areEqual, checks for deep (recursive) equality
  • New API: Sincerity.Cryptography.fileDigest
  • Sincerity.Rhino namespace now renamed to Sincerity.Platform to express support for both Nashorn and Rhino
  • "repositories:detach" command finally implemented
PRUDENCE 2.0-dev13
  • The "capture" route type can now accept an "application" param to let you capture into another Prudence application
  • Improvements to debug page
  • Better exception handling in tasks
  • Fixes to defrosting
DILIGENCE 1.0-dev8
  • New Assets service allow uses cached SHA-1 digests of files to generate unique URLs, allowing you to bypass client-side browser caches
  • reCAPTCHA: You can now configure the verifyUrl (also fixes to use Google's new URL)
How to use the Assets service:

1) Create digests for an application using "sincerity diligence digests [app name]". This will create a "digests.conf" file in the application's root directory. You will need to recreate these digests using this command everytime you change your asset files.
2) In your HTML scriptlets, you can use code like this:

<% document.require('/diligence/assets/'); var a = Diligence.Assets.getURL; %>
This is an image:
<a href="<%= a('images/logo.png') %>">

The generated URL will look something like this:

http://mysite.org/myapp/images/logo.png?_=Vt24dWrQs0pbZjwXMEnFJbhwxMo\=

The source code is very simple: look at it yourself for details until I write the proper full documentation.

MONGOVISION 1.1-dev6
  • Finally fixed a long-existing bug with support for documents that have non-ObjectID _ids. This involves JSON-ifying the _id, so now any _id structure is supported.
JSON JVM 1.1.0 and MONGODB JVM 2.1.0

These two new libraries are complete refactors of the json-rhino and mongodb-rhino libraries, now supporting Nashorn as well as Rhino (and possibly other JVM language engines in the future).

http://code.google.com/p/json-jvm/
http://code.google.com/p/mongodb-jvm/

To remind you, these allow high-performance extensible JSON and BSON conversion for the MongoDB JavaScript driver. Various small bugs were fixed for Rhino, as well.

Reply all
Reply to author
Forward
0 new messages