? All the latest updates on the Stock Market: signals, news, and everything that might move the narrative — all in one place.
? We keep an eye on the price; you can just watch us do it.
Buy Ads: @JamesCookTg
Last updated 1 month ago
The official Yescoin™
Probably something.
Play?️: @realyescoinbot
Player support: @yescoincare
Business: @advertize_support
Last updated 2 months, 1 week ago
Fast transfers & trading, send meme gifts ? and earn 100x returns — fun and flexible crypto app!
Incubated & invested by Binance Labs
When you optimizing size keep in mind that final result will be gziped before network transfer. Every comparision must be done after compression.
Let's see an example.
This is a function to detect if browser has SVG support or not:
(function(d,n){d.documentElement.className="ua_svg_"+(d[n]&&d[n]("http://www.w3.org/2000/svg","svg").createSVGRect?"yes":"no")})(document,"createElementNS")
At first look you may consider that this is optimal solution and there is nothing to improve there. We used function, passed repeated parts as one letter params.
We can do better! The code below is bigger (161 bytes versus 157), but after gzip it is smaller (126 bytes versus 154):
document.documentElement.className=document.createElementNS&&document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect?"ua_svg_yes":"ua_svg_no"
And it is easier to read IMHO.
The same for the code which detects retina display:
(function(w,e,s,c,x,l,p,d){c="className";x="deviceXDPI";l="logicalXDPI";p="devicePixelRatio";d=x in s&&l in s&&s[x]/s[l]||p in w&&w[p];d>1&&(e[c]+=" i\-ua_retina_yes")})(window,document.documentElement,screen)
After "de-optimizing" it is smaller and easier to read (191 byte versus 125):
(screen.deviceXDPI&&screen.logicalXDPI&&screen.deviceXDPI/screen.logicalXDPI||window.devicePixelRatio)>1&&(document.documentElement+=" i\-ua_retina_yes")
Notes about web site optimizations, based on my tasks on optimizing Yandex search result page.
? All the latest updates on the Stock Market: signals, news, and everything that might move the narrative — all in one place.
? We keep an eye on the price; you can just watch us do it.
Buy Ads: @JamesCookTg
Last updated 1 month ago
The official Yescoin™
Probably something.
Play?️: @realyescoinbot
Player support: @yescoincare
Business: @advertize_support
Last updated 2 months, 1 week ago
Fast transfers & trading, send meme gifts ? and earn 100x returns — fun and flexible crypto app!
Incubated & invested by Binance Labs