未加星标

Optimized For Performance

字体大小 | |
[前端(javascript) 所属分类 前端(javascript) | 发布者 店小二04 | 时间 2018 | 作者 红领巾 ] 0人收藏点击收藏

I blog a lot about data that I find in the HTTP Archive, and how I apply that data to improve websites. One interesting thing that I continuously come across in the data are files with names like “optimized.jpg” or “/images/optimized/small.jpg” and then when I look at the images, they are not optimized for delivery (meaning that they are way too big).

That got me thinking how many files in the HTTP Archive are labeled in the url with the term ‘optimized’? (Oh, and hello my British friends, I also included “optimised” in my query, but it appears much less frequently). There are also a lot of tracking gif files that are very small that have optimized in them, so I limited my search to files over 500 bytes. Finally, I broke the data down by the file extension, so we can see how many of the files are images or text or videos:

ext count optimized js 11794 jpg 5937 png 5891 php 3844 css 3747 1366 svg 526 gif 309 jpeg 184 woff 156 mp4 123 JPG 115 woff2 81 tif 70 PNG 54 ashx 53 ico 43 webp 40 ttf 19 html 18 jsonp 11

I can also obtain the median size of these files. But just knowing the size does not mean much, I want to know if these files are actually optimized . That means we need to compare these files to the general population.

Are They Optimized?

Now, I am just doing a comparison to other files in the HTTP Archive dataset. The files listed as optimized may actually have been optimized (as in “you should have seen this file before!”) and are now a lot slimmer. These optimized files may exist on pages that are more complicated that the typical website- and thus they might be expected to be larger.

But, just for fun let’s see if our optimized files are smaller than the general population. We can compare the percentiles of optimized files to the general population. A positive value indicates that the optimized files are smaller than the general population and the percentage tells us how optimized they are. In the chart below, we see that javascript, png, PHP and HTML files that are named “optimized” are generally smaller than all files.


Optimized For Performance

However, it is pretty clear that jpg, CSS, svg, gif, jpeg, woff, mp4, are all larger when the term ‘optimized’ is present. I had to cut off GIF, MP4 and ASHX files to keep the scale of the chart reasonable to read.

Conclusion

Take all url terms at face value trust but verify. If it says “optimized”, that does not mean that the file has been optimized for size. If an image has ‘width_1000’ in the url path I check anyway. Changing url names is (marginally) easier than re-encoding, and sometimes only one of the two steps is taken.

本文前端(javascript)相关术语:javascript是什么意思 javascript下载 javascript权威指南 javascript基础教程 javascript 正则表达式 javascript设计模式 javascript高级程序设计 精通javascript javascript教程

代码区博客精选文章
分页:12
转载请注明
本文标题:Optimized For Performance
本站链接:https://www.codesec.net/view/621239.html


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 前端(javascript) | 评论(0) | 阅读(20)