Closed Bug 1527215 Opened 6 years ago Closed 6 years ago

Minify the bundled Activity Stream code

Categories

(Firefox :: New Tab Page, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED WONTFIX
Iteration:
67.4 - Mar 11 - 17
Tracking Status
firefox66 --- wontfix
firefox67 --- affected

People

(Reporter: Felipe, Unassigned)

References

Details

(Whiteboard: [fxperf:p3][chore])

The Activity Stream bundle [1] is a huge file that contains a lot of comments and whitespace. It has sourcemaps, so minifying it should not cause debugging difficulties.

I threw it at a random minifier on the web, and the file was reduced by 52%, going from 486kB to 233kB. That was an aggressive minifier but I don't remember if it mangled var names.

I did a quick test on my code editor by just removing all comments and whitespace, but preserving everything else (including line breaks, names etc), and it still got a good reduction of 32%, to 330kB

We should at least give that a try to see what would be the performance benefits of that (specially for startup) to see if it's worth going down this road

[1] https://searchfox.org/mozilla-central/rev/00c0d068ece99717bea7475f7dc07e61f7f35984/browser/components/newtab/data/content/activity-stream.bundle.js

Source maps are being removed in bug 1526452 (except for local activity stream development) and have only been packaged in non-beta/release builds. The bundle is generated with webpack, so minifying as part of the bundle process should be relatively straightforward assuming we do get a performance benefit without causing too much other problems (e.g., making uplifts more difficult as the whole file would most likely conflict)

See Also: → 1526452
Iteration: --- → 67.3 - Feb 25 - Mar 10
Priority: -- → P2
Whiteboard: [fxperf] → [fxperf][chore]
Priority: P2 → P1

There might be a trade-off here between the size of the bundled file, and additional overhead costs to "re-inflate" the minified file.

Do we have a good sense of what this would buy us? Have we done any experiments to see how this impacts start-up time?

Flags: needinfo?(felipc)

I don't have a good idea, but now that we have startup_about_home_paint, let me do some manual investigation of what would be the impact. If it's any good we can send it over to AS for a proper implementation.

Assignee: nobody → felipc
Status: NEW → ASSIGNED
Flags: needinfo?(felipc)
Whiteboard: [fxperf][chore] → [fxperf:p1][chore]

Using the startup_about_home_paint test, I didn't see any improvements on reducing the size of this file.

First I removed all comments and extra blank lines, preserving everything else. That removed about 120kB from the file (from 500kB):
https://treeherder.mozilla.org/perf.html#/compare?originalProject=mozilla-central&newProject=try&newRevision=aede7723abad91d4dd50cbbd441cb24e53813179&framework=1&selectedTimeRange=172800

Then I did a slightly more aggressive version by removing all indentation, while still preserving new lines. That removed some other 30kB. Same results
https://treeherder.mozilla.org/perf.html#/compare?originalProject=mozilla-central&newProject=try&newRevision=315f271d5b6d4b97a06c6dcfa69a985f733bc36f&framework=1&selectedTimeRange=172800

With these results, I didn't go further down the path of variable name shortening, etc..

Assignee: felipc → nobody
Status: ASSIGNED → NEW
Priority: P1 → --
Whiteboard: [fxperf:p1][chore] → [fxperf:p3][chore]

I'm confused. If we're not seeing any improvement, why is this worth pursuing further, rather than just closing it with WONTFIX?

Flags: needinfo?(felipc)
Iteration: 67.3 - Feb 25 - Mar 10 → 67.4 - Mar 11 - 17

I don't think it's worth pursuing further at the moment. I left it open because in theory it's a valid request, but yeah it's better to just WONTFIX it.

Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(felipc)
Resolution: --- → WONTFIX
Component: Activity Streams: Newtab → New Tab Page
You need to log in before you can comment on or make changes to this bug.