With Ember.js 1.6.0 release the codebase was converted to use ES6 modules. While this was great for the design of the project there was a known regression announced alongside the release:
Unfortunately, adding the additional loader overhead on boot has a fairly significant performance impact on boot speed of older mobile clients (approximately 5-10% boot time penalty).
As of the 1.8.0 beta, there is unfortunately still no resolution for this issue. We are noticing ~250ms of time spent in
requireModule in Discourse right now (we are on the 1.6, cleaning up some deprecations before 1.8).
The goal of this topic is to capture what caused the regression, and determine what is involved to fix it. There are probably many people who would love to help fix it if we could articulate what the issue is and a plan forward.
The Cause (as I understand it)
The issue is that transpiling ES6 modules into ES5 format introduces overhead for each dependency in the load graph.
There is a new bundle format in the ES6 transpiler that seeks to address this. Rather than using a loader, you can concatenate all your JS together in one bundle that uses a bunch of
$characters to isolate variables.
However, the bundle format has issues with circular dependencies. It’s not simple to just switch Ember to the bundle format and have everything work.
This is where I need some guidance. How could we go about solving the problem? If people such as myself want to help out in getting Ember ready to be bundled, what is involved?
- What needs to be done to the Ember code?
- Can we divide and conquer the files to address the issues? How?