Closed mattpass closed 6 years ago
As a rough guide, running Google Closure Compiler reduces file sizes to:
bitcore-lib-btcp.js = 656kb (was 1,626kb) socket.io.js = 71kb (was 72kb), ie already compiled widget.js = 50kb (was 65kb)
= total 777kb (was 1,763kb), 44% of original size, so a 56% byte saving
Whilst this is very good and should be done, it's worthwhile considering what is in bitcore-lib-btcp.js and what we can drop. If we can get a minified version down to around 50kb that would be fantastic and mean our widget usage in its entirety could be under 200kb.
Can look to add UglifyJS to NPM dependencies and uglify within btcp_store_demo.sh
Dropped jQuery, slimmed down code and is far lighter now, so closing.
from a cold, non cached start: bitcore-lib-btcp.js = 1,500kb jquery.js = 252kb socket.io.js = 205kb socket.io.js again 70kb widget.js = 58kb = over 2mb. I think this needs to go on a diet for prod and hopefully we'll get it down to under 1mb
It's likely that we only use 1% of bitcore-lib-btcp.js and if we refactor the qrcode generator to use vanilla JS we can drop using JQuery, resulting in a 90% saving on bytes.