[{"data":1,"prerenderedAt":179},["ShallowReactive",2],{"blog:2007:shrinking-js-or-css-is-premature-optimization":3,"blogMore-Development":165,"comments-shrinking-js-or-css-is-premature-optimization":178},{"id":4,"title":5,"body":6,"category":146,"commentCount":147,"date":148,"description":149,"excerpt":150,"extension":151,"filenames":152,"hidden":153,"image":152,"meta":154,"minutes":144,"navigation":155,"path":156,"seo":157,"showCategory":152,"stem":158,"tags":159,"updated":152,"url":162,"wordCount":163,"__hash__":164},"content\u002Fblog\u002F2007\u002Fshrinking-js-or-css-is-premature-optimization.md","Shrinking JS or CSS is premature optimization",{"type":7,"value":8,"toc":142},"minimark",[9,27,82,102,108,123,136],[10,11,12,13,20,21,26],"p",{},"Rick Strahl has a post on a ",[14,15,19],"a",{"href":16,"rel":17},"https:\u002F\u002Fwest-wind.com\u002Fweblog\u002Fposts\u002F196267.aspx",[18],"nofollow","JavaScript minifier utility"," the sole job of which is to shrink the size of your JavaScript while making it almost impossible to read in order to save a few kilobytes.I thought I’d take a quick look at what the gain would be and fed it the latest version (1.6) of the very popular ",[14,22,25],{"href":23,"rel":24},"https:\u002F\u002Fwww.prototypejs.org\u002F",[18],"Prototype"," library:",[28,29,30,31],"table",{},"\n  ",[32,33,34,30,47,30,60,30,71],"tbody",{},[35,36,37,38,37,41,37,44,30],"tr",{},"\n    ",[39,40,37],"th",{},[39,42,43],{},"\n      File (KB)\n    ",[39,45,46],{},"\n      GZip (KB)\n    ",[35,48,37,49,37,52,37,57,30],{},[39,50,51],{},"\n      Standard\n    ",[53,54,56],"td",{"style":55},"text-align: right","\n      121.0\n    ",[53,58,59],{"style":55},"\n      26.7\n    ",[35,61,37,62,37,65,37,68,30],{},[39,63,64],{},"\n      Shrunk\u002Fminified\n    ",[53,66,67],{"style":55},"\n      90.5\n    ",[53,69,70],{"style":55},"\n      22.0\n    ",[35,72,37,73,37,76,37,79,30],{},[39,74,75],{},"\n      Saving\n    ",[53,77,78],{"style":55},"\n      30.7\n    ",[53,80,81],{"style":55},"\n      4.7\n    ",[10,83,84,85,89,90,95,96,101],{},"The 30.7 KB saving looks great at first glance but bear in mind that external JavaScript files are cached on the client between page requests and it looses some appeal.If you also consider the fact that most browsers and clients support GZip compression and the savings there are around ",[86,87,88],"strong",{},"4.7 KB"," and you might wonder if you are wasting your time.In computer science there is a term for blindly attempting to optimize systems without adequate measurement or justification and that term is premature optimization.As ",[14,91,94],{"href":92,"rel":93},"https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FC._A._R._Hoare",[18],"Sir Tony Hoare"," wrote (and ",[14,97,100],{"href":98,"rel":99},"https:\u002F\u002Fwww-cs-faculty.stanford.edu\u002F~knuth\u002F",[18],"Donald Knuth"," paraphrased)",[103,104,105],"blockquote",{},[10,106,107],{},"We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.",[10,109,110,111,116,117,122],{},"And he was working on computers throughout the 60’s and 70’s that had much less resources than those today.By all means if your server bandwidth is an issue delve into the stats, identify the cause and take it from there. Going with ",[14,112,115],{"href":113,"rel":114},"https:\u002F\u002Fdeveloper.yahoo.com\u002Fyslow\u002F",[18],"Yahoo’s YSlow plug-in for Firefox\u002FFirebug"," is a great starting point but remember to analyze the statistics ",[14,118,121],{"href":119,"rel":120},"https:\u002F\u002Fwww.codinghorror.com\u002Fblog\u002Farchives\u002F000932.html",[18],"from your own context",".",[10,124,127,128,135],{"className":125},[126],"construction","\n  Rick’s tool ",[129,130,134],"span",{"style":131,"className":132},"font-weight: bold",[133],"Apple-style-span","had"," shortcomings with non-ASCII characters such as accents, symbols and non-US currency symbols which goes to show how optimization can have other unintended and undesirable effects.\n",[10,137,138],{},[139,140,141],"em",{},"[)amien",{"title":143,"searchDepth":144,"depth":144,"links":145},"",2,[],"Development",8,"2007-11-27T08:11:36+00:00","Rick Strahl has a post on a JavaScript minifier utility the sole job of which is to shrink the size of your JavaScript while making it almost impossible to read in order to save a few kilobytes.I thought I’d take a quick look at what the gain would be and fed it the latest version (1.6) of the very popular Prototype library:","[object Object]","md",null,false,{},true,"\u002Fblog\u002F2007\u002Fshrinking-js-or-css-is-premature-optimization",{"title":5,"description":149},"blog\u002F2007\u002Fshrinking-js-or-css-is-premature-optimization",[160,161],".NET","JavaScript","\u002Fblog\u002F2007\u002Fshrinking-js-or-css-is-premature-optimization\u002F",279,"fahMitu8-tFFti07DLq0KRELmrc6EJgdyrdEEKVhSvM",[166,170,174],{"title":167,"date":168,"url":169},"Transactions in the MongoDB EF Core Provider","2025-10-25","\u002Fblog\u002F2025\u002Fmongodb-explicit-transactions\u002F",{"title":171,"date":172,"url":173},"Queryable Encryption with the MongoDB EF Core Provider","2025-09-22","\u002Fblog\u002F2025\u002Fmongodb-queryable-encryption\u002F",{"title":175,"date":176,"url":177},"Lazy Loading with EF Core Proxies","2025-04-02","\u002Fblog\u002F2025\u002Fef-proxies\u002F",[],1780900529475]