I was looking through our application and removing redundant code. I was checking the size of our application and wondered if I could reduce the size. A smaller download size will give the user a better user experience.
How long will you wait for a website to load before you give up and go somewhere else? Ten seconds? Twenty seconds? Apparently, nearly half of us won’t wait even three seconds.
https://www.bbc.co.uk/news/business-37100091
In my research, I found this blog https://www.freecodecamp.org/news/3-easy-ways-to-boost-your-web-application-performance/ which mentions a few areas to look at; reducing image sizes, code-splitting/lazy loading, and reducing the bundle size.
For the third point, it gives an example of a Javascript date library called “moment” which is something my team was using. When I looked at our bundle stats, Moment was contributing to 30% of the size of our app! We only used it as part of a Date picker control which we use once. The blog recommended a website called Bundlephobia e.g. https://bundlephobia.com/result?p=moment@2.24.0 which shows you the size, and recommends some alternative libraries. Moment is 231.7kB and 65.9kb (compressed) whereas “daysjs” is only 6.5kB and 2.76 compressed. If you look at their time stats, the site reckons it will take around 1 second longer to use Moment rather than DayJS.
According to research from digital performance measurement firm Dynatrace, just a half second difference in page load times can make a 10% difference in sales for an online retailer.
https://www.bbc.co.uk/news/business-37100091
Git Hub user martinheidegger logged this very issue back in Aug 2016 https://github.com/moment/moment/issues/3376
It looks like development/maintenance has slowed down this year, but I’m surprised that the Moment library hasn’t been abandoned completely. Loads of people have highlighted the size is a problem, yet no one has actually sorted the issue out after all these years.
When the research highlights how important fast speeds are to users, then you would think developers would put more important on performance.