Polyfills might slow down code

Babel should have no effect on performance, however

Image for post
Image for post

Thanks for stopping by John Au-Yeung !!! I always really enjoy your programming articles, so thank you for your response to mine.

Theoretically, there are cases where polyfills will slow down the code significantly, especially if one were to test how well those polyfills actually run in something like IE9.

I found one such case, where the padStart() function from the ES2018 specification is over 8x faster than its polyfill:

Transpiling should not make any difference

As far as Babel is concerned, translating syntactic sugar from currently-allowed syntax to the older format should be just as fast.

Polyfills only suffer performance hits because they are entirely new features that have been added to JavaScript β€” not just syntax changes.

I agree with you that it is amazing how far JavaScript has come β€” it is a much easier to learn and usable language than a decade ago.

Thanks to all those who have submitted ECMAScript proposals and written cool JavaScript frameworks & associated tools!

Written by

πŸ€“ The physical therapist who writes JavaScript πŸ’ͺ Web Developer 😎 Mentor 🧠 DPT πŸ˜„ SEO Expert 😁 React πŸ˜† Jamstack πŸ—―οΈ Ask me anything πŸ‘‰ DoctorDerek.com πŸ‘ˆ

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store