压缩和未压缩的文件大小没有区别
来源:6-8 静态资源服务器 08--压缩文件

小王子抓猫咪
2017-10-15
使用的chrome浏览器,比较了压缩前和压缩后的文件,没有大小上的改变。有的甚至压缩后比未压缩的还要大一点点。不知道为什么。
是因为chrome浏览器自带就有压缩功能吗?
6回答
-
Samaritan
2017-11-26
https://stackoverflow.com/questions/20762094/how-are-zlib-gzip-and-zip-related-what-do-they-have-in-common-and-how-are-they/20765054#20765054
00 -
Samaritan
2017-11-26
There is no direct correlation between file size and compressed size.
I.e. sample for RLE compression (much worse than GZIP, but easier to show idea):
File 1: {0,0,0,0} 4 bytes compresses to approximately 2 bytes {4,0}
File 2: {1,2,3,4} 4 bytes grows to approximately 8 bytes instead of compression {1,1,1,2,1,3,1,4}
In general more random data is in the file than less compressible file is.
For compiled binaries different options may trigger extra tables to be included (like source locations) or use different (ASCII vs. UTF-16) string representation - all this may change amount of repetition in the file that compression can use to actually compress binaries.
00 -
圣歌奏
2017-11-26
我的也没有变换,我的连content-encoding都没在响应头中出现
00 -
Delucia
2017-11-22
同样..
00 -
蓝with黑
2017-11-20
我也是。没变,不知道为啥
00 -
Samaritan
2017-10-15
是不是用的文件太小了?看个稍微大一些的文件试试
00
相似问题