大网数据广告活动
网站运营与故障问答

What Gzip compression level can safely be used for sitemap files?

· 52CE 我爱测

I can use PHP's gzencode function to set the compression level of data to compress and I want to compress my sitemap files then submit them to google. Currently my compression level is set to 2 because I believe that's a standard…

问题原文

原帖链接 · Mike -- No longer here · CC BY-SA 3.0

I can use PHP's gzencode function to set the compression level of data to compress and I want to compress my sitemap files then submit them to google.

Currently my compression level is set to 2 because I believe that's a standard value. The highest level is 9. My question is, will (at least all major) search engines support decoding sitemap files that are gzipped at a higher compression level than 2, if so, what's the highest level?

I don't want to use compression level 9 only to find out a search engine could not process the sitemap.

已采纳解答

原帖链接 · Stephen Ostermiller · CC BY-SA 3.0

All Gzip decompression programs can decompress any of the levels. The compression level doesn't change the format of the output at all.

The compression level is good for managing load on your server. Gzip will spend many more CPU cycles trying to compress the data better when you specify a higher compression level.

In my experience the benefits of higher compression levels are modest at best. The default compression level is almost as good as the higher compression levels and much less intensive during compression.

As a general rule you should use lower compression levels if you are compressing something on the fly. If you are compressing something that will be downloaded thousands of times you could think about using higher compression levels.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2016-01-10)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。