Author Topic: PixInsight 1.7 — New PJSR Engine (SpiderMonkey 1.8.5)  (Read 9477 times)

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Hi all,

The new version 1.7.0 of PixInsight includes a new JavaScript engine: SpiderMonkey version 1.8.5, the latest version of Mozilla's JavaScript engine. This is the same engine used in Firefox 4.

SpiderMonkey 1.8.5 is a huge step forward because it includes two JIT (Just-In-Time) compilers: a trace-based JIT  (also known as TraceMonkey) and a method JIT (also known as JaegerMonkey). The JIT compilers translate JavaScript code into machine code dynamically, while the scripts execute.

This has been a relatively complex and time-consuming task because I've had to rewrite most of PJSR code, but it is now 100% operational and fully tested. As expected, it has been well worth the effort: the performance improvement is spectacular.

Here are some benchmarks:

Machine
Intel Core i7 990 X @ 3.47 GHz / 24 GB RAM

Operating System
Fedora 14 Linux x86_64 / Kernel 2.6.35.12-90 / GNOME 2.32.0

Test Image
1522x1262 px / 32-bit floating point / RGB color

PixInsight versions:
1.7 = 1.7.0.684 (development version)
1.6 = 1.6.9.652 (current publicly released version)

3DPlot script
1.6: 55.0 seconds
1.7: 39.7 seconds (28% faster)
Default script parameters. The resulting image is 11686x3872 px.

Spherize script
1.6: 4.21 seconds
1.7: 2.36 seconds (44% faster)
Rendition on a sphere of diameter = 1200 px.

PolarCoordinates script
1.6: 3.93 seconds
1.7: 1.28 seconds (67% faster)

Scripts whose execution times are dominated by native PJSR routines have bottlenecks that make JIT compiler optimizations comparatively less relevant. This is the case of the 3DPlot script, which is strongly dominated by the polygon drawing PJSR routine (Graphics.drawPolygon()), hence the relatively 'small' improvement (28%).

On the other hand, those scripts consisting mostly of 'pure' JavaScript code see the best improvements, as happens with Spherize (44%) and PolarCoordinates (67%). These scripts basically carry out their entire tasks in JavaScript, then call ultra-fast PJSR routines to write image pixels.

Besides optimizations and performance improvements, the new PJSR in PixInsight 1.7 fully implements the ECMAScript 262-5 standard (with the exception of the Math object, which PJSR redefines to provide a much more powerful and faster math support). This includes ES5's strict mode, getters, setters, JSON, etc. The new strict mode is optional --which means that all existing scripts will continue working without problems-- but we encourage all developers to write strict mode compliant code, as well as to port existing scripts when necessary. All PJSR headers, the development scripts and all scripts automatically generated by the PI Core application are now strict mode compliant. The most 'dramatic' impact of strict mode on existing PJSR scripts is the fact that the 'with () {}' statement is now forbidden. I'll comment more on the repercussions of this change in a new post.
« Last Edit: 2011 April 30 15:15:59 by Juan Conejero »
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline sreilly

  • PixInsight Padawan
  • ****
  • Posts: 791
    • Imaging at Dogwood Ridge Observatory
Re: PixInsight 1.7 — New PJSR Engine (SpiderMonkey 1.8.5)
« Reply #1 on: 2011 April 30 15:49:52 »
Any idea when 1.7 will be ready for release?

Thanks,

Steve
Steve
www.astral-imaging.com
AP1200
OGS 12.5" RC
Tak FSQ-106ED
ST10XME/CFW8/AO8
STL-11000M/FW8/AO-L
Pyxis 3" Rotator
Baader LRGBHa Filters
PixInsight/MaxIm/ACP/Registar/Mira AP/PS CS5

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: PixInsight 1.7 — New PJSR Engine (SpiderMonkey 1.8.5)
« Reply #2 on: 2011 April 30 16:57:33 »
Hi Steve,

It is almost finished. I think it will be ready for release in a week or so.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: PixInsight 1.7 — New PJSR Engine (SpiderMonkey 1.8.5)
« Reply #3 on: 2011 April 30 21:47:06 »
Haha JaegerMonkey :)
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: PixInsight 1.7 — New PJSR Engine (SpiderMonkey 1.8.5)
« Reply #4 on: 2011 May 01 02:18:44 »
For those interested: The official standards document is here http://www.ecma-international.org/publications/standards/Ecma-262.htm .
Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: PixInsight 1.7 — New PJSR Engine (SpiderMonkey 1.8.5)
« Reply #5 on: 2011 May 01 04:47:29 »
John Resig has some good descriptions of the new ES5 features on his blog:

http://ejohn.org/blog/ecmascript-5-objects-and-properties/

as well as strict mode and JSON object serialization:

http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/

Also you may be interested in Mozilla's ES5 support (which is the same as PJSR's ES5 support):

https://developer.mozilla.org/En/JavaScript/ECMAScript_5_support_in_Mozilla
https://developer.mozilla.org/en/JavaScript/New_in_JavaScript/1.8.5
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: PixInsight 1.7 — New PJSR Engine (SpiderMonkey 1.8.5)
« Reply #6 on: 2011 May 01 11:28:23 »
Extra speed is nice but more importantly, will this release have a debugger? As I recall we talked about that a year+ ago. That would be really huge.
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: PixInsight 1.7 — New PJSR Engine (SpiderMonkey 1.8.5)
« Reply #7 on: 2011 May 03 11:05:06 »
Quote
will this release have a debugger? As I recall we talked about that a year+ ago. That would be really huge.

Not in this release, but I have it planned. Maybe during the 1.7 cycle. As you know I was thinking on migrating PJSR to SquirrelFish Extreme (Safari's JS engine). However, after the excellent development I've seen in SpiderMonkey during the last months I have decided to stick with Mozilla's engine. One of the reasons for taking this decision is the new Debug object:

https://wiki.mozilla.org/Debug_Object

which looks really promising IMO. Even before Debug is stable, I can add some (pretty basic, for now) debugging capabilities to PJSR thanks to ES5's greater introspection capabilities.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: PixInsight 1.7 — New PJSR Engine (SpiderMonkey 1.8.5)
« Reply #8 on: 2011 May 03 11:06:05 »
That's great new Juan, thanks!
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline Yuriy Toropin

  • PixInsight Addict
  • ***
  • Posts: 209
Re: PixInsight 1.7 — New PJSR Engine (SpiderMonkey 1.8.5)
« Reply #9 on: 2011 June 01 02:57:38 »
Another benchmark

Machine
   Intel Core 2 Quad Q9650 @ 3.00 GHz / 8 GB RAM

Operating System
   Windows 7 Ultimate 64bit

Test Image
   5000x5000 px / 32-bit floating point / Grayscale

PixInsight versions:
1.7 = 1.7.0.696 x64 (current publicly released version)
1.6 = 1.6.9.652 x64 (previously publicly released version)

MaskedStretch
1.6: 984.6 seconds
1.7: 474.7 seconds (~52% less time spent or 2.07x times faster!!!)
Script parameters are on screenshot.

That's a GREAT improvement in speed! Thanks a lot, Juan and the Team!