Chrome Dev Tools - “Size” vs “Content”

血红的双手。 提交于 2019-11-26 08:46:07

问题


When viewing information about stylesheets in the Network tab of Chrome\'s dev tools, one column specifies both \"size\" and \"content\":

\"Screenshot

Can anybody shed light on the difference between these two numbers? On some pages the numbers are close and others they are different by a considerable amount.


回答1:


"Size" is the number of bytes on the wire, and "content" is the actual size of the resource. A number of things can make them different, including:

  • Being served from cache (small or 0 "size")
  • Response headers, including cookies (larger "size" than "content")
  • Redirects or authentication requests
  • gzip compression (smaller "size" than "content", usually)

From the docs:

Size is the combined size of the response headers (usually a few hundred bytes) plus the response body, as delivered by the server. Content is the size of the resource's decoded content. If the resource was loaded from the browser's cache rather than over the network, this field will contain the text (from cache).




回答2:


Size is the size of response itself, and Content is the size of resource, that you are accessing.

Compare:

empty cache:

main.js GET 200 OK .. Size: 31.72KB Content: 31.42KB

cached:

main.js GET 304 Not modified .. Size: 146B Content: 31.42KB




回答3:


In simple terms Google article explain it as Size = Transfer size and Content = Actual size

This is my formula based on reading various articles on this topic (and I am open to improve it further with your comments) Size = Compression(Content) + Response Header

See the image used in this article

Explanation by Google




回答4:


"Use large request rows" to show both values!

If you don't see the second value (content) you need to click the "Use large request rows" button inside Chrome Network tab:

I found this thanks to the answer on this question here:

Chrome Devs tools - where's size and content?



来源:https://stackoverflow.com/questions/8072921/chrome-dev-tools-size-vs-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!