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

Reduce bundle size #364

Merged

Conversation

orangemug
Copy link
Collaborator

@orangemug orangemug commented Aug 22, 2018

This is a work in progress, mostly complete just requires some testing

  • Use the browsers fetch rather than the request module
  • base64-loader -> raw-loader
  • Remove ol3 for now because it's been broken for a while
  • Removed old GitHub gist support as it's no longer functional
  • Removed Mousetrap as we were only using a small part of the functionality
  • Moved to single js file to make things simplier

Here are some stats:

               vendor (before)   app (before)   vendor (after)   app (after)
Stat size:     3.26MB            4.5MB          n/a              3.42MB
Parsed size:   1.95MB            1.9MB          n/a              2.09MB
Gzipped size:  549.64KB          449.93KB       n/a              507.41KB
Gzipped total size before: 549.64KB + 449.93KB  = 999.57KB
Gzipped total size after: 507.41KB (saving ~49% saving)
Parsed total size before: 1.95MB + 1.9MB  = 3.85MB
Parsed total size after: 2.09MB (saving ~45% saving)

This should also improve startup time also. Local js parse times

Before

vendor.js 267.46ms
app.js    242.23ms
total     509.69ms

After

vendor.js  n/a
app.js     341.22ms (~33% speed up)

Full results

Note: that the removed OpenLayers dependency accounted for a major chunk of those savings when we fix and re-enable OpenLayers we should make sure it's loaded externally from main bundle and only loaded when required.

 - Use the browsers fetch rather than the request module
 - base64-loader -> raw-loader
 - Remove ol3 because it's been broken for a while
 - Removed old GitHub gist support as it's no longer functional
 - Removed Mousetrap as we were only using a small part of the functionality
 - Moved to single js file to make things simplier


class Gist extends React.Component {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi, this code seemed depreciated but the ability to save a style is a nice feature. Is there any plan to add such a feature in the future? For instance, let's say I wanted to save a style to Github for instance.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hi @loicgasser, so this used to exist but then GitHub changed their API removing anonymous gists. Keep an eye on issue #155 for any updates

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the pointer

@orangemug orangemug merged commit 7e5fb4d into maplibre:master Sep 10, 2018
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.

2 participants