Saving a few kbytes

August 2, 2017

I had a chat with a developer outside my company and we had a discussion about the “unnecessary” usage of libraries. You know slowing down the loading speed etc. Our discussion started from whether help libraries like jQuery or lodash should be used or should we just use the plain JS functions. The classical, is it really worth including the whole library for this one function?.

And although I don’t disagree completely, I always prefer libraries where it is not directly offered by JS, because:

1) Realistically, the feature is implemented far better than I would. It comes with covered edge cases and tests. 2) It most likely offers the option to import parts of the library, maybe even single functions. 3) The few kbytes are not worth saving! Split code and slim your pages that you load and it will never be a problem.

So just make sure to have decent build and packaging and all is good.