Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perf: Save 597 gz bytes through code sharing #637

Merged
merged 6 commits into from
Sep 13, 2019
Merged

Conversation

brandonocasey
Copy link
Contributor

@brandonocasey brandonocasey commented Aug 19, 2019

Description

74033 -> 72945

We inline 4-5 @babel/runtime helpers, 4 different Stream classes, 3 base 64 to uin8array functions, and two resolve urls (which each includes their own version of url-toolkit.). This full request removes all the duplicate code and moves it to @videojs/vhs-utils. It also updates videojs-generate-rollup-config to deal with sharing @babel/runtime helpers.

Depends on the following generator and small code updates:

Closes #640
Closes #641

@@ -2,22 +2,9 @@
* @file resolve-url.js - Handling how URLs are resolved and manipulated
*/

import URLToolkit from 'url-toolkit';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does URLToolkit need to be a direct dep of VHS anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does not

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually isn't anymore, just a dev dependency, as it's used in tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, cool, missed that it was moved over.

@gkatsev
Copy link
Member

gkatsev commented Aug 19, 2019

I wonder if there could be any issues with the stream.js compat across the libs. They mostly look the same but there's some minor changes.

@brandonocasey
Copy link
Contributor Author

stream.js only had one difference between aes-decrypter, m3u8-parser, and mux.js and it was actually a bug that was fixed in Mux.js. https://github.com/videojs/vhs-utils/blob/master/src/stream.js#L51

@gkatsev
Copy link
Member

gkatsev commented Aug 19, 2019

FYI, tests are failing. Also, we'd want to make sure that the deps get non-prerelease releases before we merge this.

@brandonocasey brandonocasey changed the base branch from perf/dedupe-mux-aes to master August 19, 2019 20:35
@brandonocasey brandonocasey force-pushed the perf/vhs-utils branch 2 times, most recently from 986bad6 to 8cd081f Compare August 19, 2019 20:52
@brandonocasey brandonocasey changed the title Perf: Save 1088 gz bytes through code sharing Perf: Save 597 gz bytes through code sharing Aug 19, 2019
@brandonocasey brandonocasey force-pushed the perf/vhs-utils branch 2 times, most recently from dc0d8b1 to b9c1b62 Compare September 9, 2019 22:02
const player = this.player;
// TODO: why does this make the next test
// throw an "The operation was aborted." on firefox
if (!videojs.browser.IS_FIREFOX) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firefox 69 started throwing an error "The Operation was aborted", and no amount of promise silencing seems to help. The test itself actually passes, but it throws an error that causes a global failure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This happens in master too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should instead use QUnit.skip? Maybe QUnit[videojs.browser.IS_FIREFOX ? 'skip' : testFn]?

function(assert) {
const done = assert.async();
let appendsFinished = 0;
if (!videojs.browser.IS_EDGE) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is failing intermittently on edge, even in master, since edge throws on setDuration sometimes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about skipping here.

Copy link
Member

@misteroneill misteroneill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, changes look fine. I had a couple questions about skipping tests in a different way that avoids the large indent changes. Feel free to ignore. :)

const player = this.player;
// TODO: why does this make the next test
// throw an "The operation was aborted." on firefox
if (!videojs.browser.IS_FIREFOX) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should instead use QUnit.skip? Maybe QUnit[videojs.browser.IS_FIREFOX ? 'skip' : testFn]?

function(assert) {
const done = assert.async();
let appendsFinished = 0;
if (!videojs.browser.IS_EDGE) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about skipping here.

@brandonocasey brandonocasey merged commit eb940ba into master Sep 13, 2019
@brandonocasey brandonocasey deleted the perf/vhs-utils branch April 16, 2020 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants