Asciidoctor.js on Nashorn JDK 9 is considerably slower than Nashorn JDK 8
Guillaume Grossetie
grossetieg at gmail.com
Sat Jan 3 20:01:15 UTC 2015
Hello everyone and happy new year!
Asciidoctor.js is now running on both JDK 8b19 (build 25.40-b23) and JDK
9b44 (build 1.9.0-ea-b44).
We noticed that JDK 9 is considerably slower than JDK 8 Nashorn but at the
same time running "basic" Javascript seems faster on JDK 9.
We have a simple Rake task[1] that execute the same examples with the
latest JDK 8 and JDK 9:
*Result with JDK 8:*
Running Nashorn jjs spec/share/basic.js... OK in *909.052 ms*
Running Nashorn jjs spec/share/asciidoctor-convert.js... OK in *9335.534 ms*
Running Nashorn java BasicJavascriptWithNashorn... OK in *927.053 ms*
Running Nashorn java AsciidoctorConvertWithNashorn... OK in *8843.506 ms*
So less than a second for basic Javascript and around 10 seconds to convert
AsciiDoc source to HTML5.
*Result with JDK 9:*
Running Nashorn jjs spec/share/basic.js... OK in *860.049 ms*
Running Nashorn jjs spec/share/asciidoctor-convert.js... OK in *31253.788
ms*
Running Nashorn java BasicJavascriptWithNashorn... OK in *833.048 ms*
Running Nashorn java AsciidoctorConvertWithNashorn... OK in *30584.749 ms*
As you can see basic.js runs a little faster but asciidoctor-convert.js is
considerably slower (three times slower ~30 seconds).
The basic.js[2], asciidoctor-convert.js[3] and asciidoctor-all.js[4] are
available on GitHub.
Asciidoctor.js is generated from Ruby using Opal[5] as a result the
file asciidoctor-all.js
is not easy to read but the entry point is the method $convert[6].
Let me know if you need more information.
Cheers,
Guillaume
[1] https://github.com/asciidoctor/asciidoctor.js/blob/master/Rakefile#L105
[2]
https://github.com/asciidoctor/asciidoctor.js/blob/master/spec/share/basic.js
[3]
https://github.com/asciidoctor/asciidoctor.js/blob/master/spec/share/asciidoctor-convert.js
[4]
https://github.com/asciidoctor/asciidoctor.js/blob/master/dist/asciidoctor-all.js
[5] http://opalrb.org/
[6]
https://github.com/asciidoctor/asciidoctor.js/blob/master/dist/asciidoctor-all.js#L24419
More information about the nashorn-dev
mailing list