Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 470742

Summary: Shoot Rhino, use Node
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: RelengAssignee: Anthony Hunter <ahunter.eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ahunter.eclipse, steve_northover
Version: 9.0   
Target Milestone: 10.0   
Hardware: PC   
OS: All   
See Also: https://github.com/jrburke/r.js/issues/822
Whiteboard:

Description Mark Macdonald CLA 2015-06-22 15:08:08 EDT
Steve has reminded me that the orion-client build is slow. This is mostly due to minification with r.js. We should see if there's any improvement to be had running under Nashorn rather than Rhino.

Docs on using r.js with Rhino are here:
https://github.com/jrburke/r.js#nashorn

This might be as simple as changing orion.mini.xml to run the `jjs` command instead of `java -jar rhino.jar`.
Comment 1 Steve Northover CLA 2015-06-22 15:16:46 EDT
It would be worth our while to investigate this to see how much time we can get back (if any).  Could you spend some time on this (an hour or two, only if you can spare it)?  If not,  who would be a good choice?
Comment 2 Mark Macdonald CLA 2015-06-22 19:20:17 EDT
Hi Anthony

I took a quick stab at this earlier, here is my progress:
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/log/?h=mmacdonald/nashorn

It has r.js partly working under Java8/Nashorn. There are still a bunch of errors:

> [exec] TypeError: Cannot read property "invoke" from undefined
> [exec] TypeError: Cannot read property "invoke" from undefined

... But it might be enough to decide if this is worth pursuing further. So far it does not feel any faster, also jjs.exe uses a ton of memory (4GB+). But see what you think.
Comment 3 Mark Macdonald CLA 2015-06-25 10:54:15 EDT
I got test builds working under both Nashorn and Node.js. Here are the times:

> |      Method           | mm:ss |
> ---------------------------------
> | [1] Rhino (no change) | 28:00 |
> | [2] Nashorn           | 13:00 |
> | [3] Node              |  8:20 |

tl;dr switching to Node cuts build time by 3x. This does limit the platforms that the Orion build can run on -- since Node.js binaries are only provided for Windows/Linux/OS X -- but I think it's worth it, assuming we post a heads-up on orion-dev and orion-releng warning people about the change.

[1] https://hudson.eclipse.org/orion/job/orion-client-dev.no-tests/3/
[2] https://hudson.eclipse.org/orion/job/orion-client-dev-node_TEMP/2/
[3] https://hudson.eclipse.org/orion/job/orion-client-dev-nashorn_TEMP/8/
Comment 4 Anthony Hunter CLA 2015-06-25 11:27:57 EDT
You are using https://www.npmjs.com/package/node-minify right?

This would seem like the best approach.
Comment 5 Steve Northover CLA 2015-06-25 12:08:26 EDT
Oh please, please, please make our build faster.  

My vote: Try Node first, then fail back to java (either Nashorn or Rhino)?  Only do this if it's easy.  Otherwise, just do Node.
Comment 6 Anthony Hunter CLA 2015-06-25 15:33:19 EDT
Flip the bit to make this the default. There is no risk in trying this out.
Comment 7 Mark Macdonald CLA 2015-06-25 15:34:49 EDT
I will, I'm just seeing if it's easy to support both paths (Node with Java as a fallback). If it doesn't complicate the build too much, I will do both.
Comment 9 Mark Macdonald CLA 2015-06-25 23:52:24 EDT
The build now works with either Node.js or Nashorn. Rhino is extinct
Comment 10 Mark Macdonald CLA 2015-06-25 23:57:49 EDT
Note that the final build times are longer than those published in Comment 3, because running the tests adds an extra 6 minutes or so, and that time has not improved any.

Total time for orion-client-dev has gone from 35 minutes to 15 minutes.
Comment 11 Steve Northover CLA 2015-06-26 10:32:35 EDT
Death to the Rhino!!  Thanks Mark.