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

Bug 470500

Summary: Investigate decreasing the number of scripts loaded by requirejs in the worker at dev-time
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: JS ToolsAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: Silenio_Quarti, simon_kaegi
Version: 9.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
requirejs patched to use xhr and blob urls instead of just importScripts none

Description Michael Rennie CLA 2015-06-18 11:05:25 EDT
From bug 465610 comment #5 - we need to investigate different ways to speed up how the worker loads scripts - we need requirejs / node as Tern needs a loader for plugins and definition - so we need to figure out how to speed that up worker-side
Comment 1 Simon Kaegi CLA 2015-06-18 12:26:46 EDT
Created attachment 254553 [details]
requirejs patched to use xhr and blob urls instead of just importScripts

This is kind of goofy and just a proof-of-concept but at least will download scripts in parallel inside of a web worker.
Comment 2 Simon Kaegi CLA 2015-06-18 13:51:09 EDT
things to do/fix...

cross-origin
error handling
csp check
Comment 3 Simon Kaegi CLA 2015-06-18 16:31:03 EDT
The times I'm getting for measuring the time to resolve the dependencies for ternWorkerCore are...

Before: (ms)
1) 3096
2) 3094
3) 3093

After: (ms)
1) 922
2) 792
3) 885

I'm going to start the conversation with James Burke to see if he's interested in incorporating into RequireJS

https://github.com/jrburke/requirejs/issues/1220
Comment 4 Simon Kaegi CLA 2015-06-18 16:36:51 EDT
With an empty cache the times were more like 8000ms (Before) and 1500ms (after)
Comment 5 Michael Rennie CLA 2015-06-18 17:21:37 EDT
took some timings:

without patch:
2498ms
2358ms
2289ms
2357ms

With patch:
447ms
424ms
424ms
452ms
Comment 6 Michael Rennie CLA 2015-06-18 17:25:58 EDT
We should consider this in for 9.0, it really improves the first load time. Although, I would like to have a build with this in it to make sure the embedded editor is not affected.
Comment 7 Silenio Quarti CLA 2015-06-24 12:55:51 EDT
Let's get this out soon (now that Orion 9.0 is out).

Do we need to address the problems mentioned in comment#2 before committing the code?

I think cross-site is not an issue given workers can only load scripts on the same domain.
Comment 8 Michael Rennie CLA 2016-06-09 14:47:59 EDT
I'm going to close this as wontfix. We have tried using the patch (which makes debugging impossible), and modifying the patch - but anything other than working with blobs has almost no effect on loading time.

Since this only affects target sites, its not needed at the expense of ease of debugging.