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

Streamline our codebase #9

Open
vitorbaptista opened this issue Jan 31, 2016 · 4 comments
Open

Streamline our codebase #9

vitorbaptista opened this issue Jan 31, 2016 · 4 comments

Comments

@vitorbaptista
Copy link
Contributor

The compiled code is extremely big, given how little it does. As of d4073c1, it has 570 KB (133 KB gzipped). Even after minifying with uglifyjs --compress --mangle, it still has 258 KB (71 KB gzipped). It includes the registry and its schemas, but it's still huge.

@vitorbaptista vitorbaptista self-assigned this Jan 31, 2016
vitorbaptista added a commit that referenced this issue Feb 3, 2016
We were only using it for the `.promisify()` method. Without it, the bundled
codebase goes from 546 KB to 398 KB. Still huge.
vitorbaptista added a commit that referenced this issue Feb 3, 2016
That's the only thing we're using anyway. This lowers our codebase from 398 KB
to 381 KB.
vitorbaptista added a commit that referenced this issue Feb 3, 2016
The RegExp isn't as good as what's done by URL, and we also consider
"file://.*" to be a remote URL, but the code went from 378 KB to 335 KB.
vitorbaptista added a commit that referenced this issue Feb 3, 2016
When requiring the polyfill, we're polluting the global scope, and making our
codebase bigger. They're not needed on many newer browsers, which might be all
that our users need to support. We can't make this decision for them, so we
better just document it.
@vitorbaptista
Copy link
Contributor Author

This will probably be useful https://github.com/samccone/The-cost-of-transpiling-es2015-in-2016

@pwalsh
Copy link
Contributor

pwalsh commented Feb 3, 2016

Is the problem we have one of transpilation? This code was not transpiled until this latest refactor. Is there a demonstrable bloat attributable to ES6?

@vitorbaptista
Copy link
Contributor Author

Yes, but mostly because of the need for polyfills. The biggest culprits of the current size are:

  • csv-parse: 85 KB minified (!!!);
  • isomorphic-fetch: 7KB minified.

A smaller CSV parsing library would go a long way...

@pwalsh
Copy link
Contributor

pwalsh commented Feb 3, 2016

So we use this for client side CSV http://papaparse.com/ in most recent projects. that doesn't help with node.js though.

Also if this shows us that even on a very small lib like this, that ES6 creates too much bloat, we at least learn that at least in the case of isomorphic js apps, we should stick to ES5. LMK what you think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants