Paypal-checkout-components: Excessive checkout.js file size

Created on 17 Aug 2017  路  5Comments  路  Source: paypal/paypal-checkout-components

I nearly fell of my chair when I saw how big (1.2Mb) this checkout.js file is. Granted, Gzip compression helps a lot but it hasn't been minified either. That alone would have saved ~35%.

Forcing users to download that sort of size file over a 3g network in many countries where they have no other option isn't very smart and causes customer drop off.

By comparison, if I head over and have a quick look at stripe.js, their js download is 75Kb, downloads in 14ms, while this is 1.2Mb and downloads in 196ms (tested on 80mb/sec line)

outdated

Most helpful comment

@bluepnume

Came here to post this.

+1 to adding it to docs/demos? Or at least mentioning it.

Why should devs waste time finding our that min version exists?

All 5 comments

Hi @deejbee.

There's a minified version at https://www.paypalobjects.com/api/checkout.min.js which clocks in at 98kb.

I definitely agree there's work to be done here. We have plans to:

  • Lazy load anything which isn't required for the first render
  • Create a version of the script which doesn't contain legacy integration methods
  • Split out code which is only needed on the child window
  • Conditionally load localization content based on detected locale

I should also point out, if I may -- I believe the equivalent script on Stripe's side, which handles the checkout UI, is https://checkout.stripe.com/checkout.js. By the time that has finished loading its 20 different dependencies, it totals out at 472kb:

screen shot 2017-08-17 at 10 26 38 am

Looking forward to any improvements.

It would probably be a good idea to at least point the documentation to use the minified version at least?

https://developer.paypal.com/docs/integration/direct/express-checkout/integration-jsv4/upgrade-integration/

Also, regarding timings. Just downloading checkout.min.js is typically an order of magnitude slower (> 120ms) than https://checkout.stripe.com/checkout.js (~12ms). That could just be a CDN issue. The perceived load time of paypal is also orders of magnitude slower, with checkout.js showing a spinner in a popup window for around 3 seconds in production, before anything useful for payment is shown, while stripe shows the popup payment window almost instantaneously, without any need for a spinner.

I can appreciate that paypal will have a lot more baggage to carry and has a lot more features to deal with, but perceived speed is how customers rate their experience.

Closing this as there's an existing discussion here: https://github.com/paypal/paypal-checkout/issues/44

I'm going to try to find some priority for the things we discussed, in the next few weeks. Adding a link to the minified script in the docs is a good plan.

@bluepnume

Came here to post this.

+1 to adding it to docs/demos? Or at least mentioning it.

Why should devs waste time finding our that min version exists?

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings