背景 VS 背景颜色:性能
Background VS background-color: performance
我想知道这个,经过一番挖掘,发现 this resource, linked in this answer。
资源状态:
Background vs background-color
Comparison of 18 color swatches rendered 100 times on a page as small
rectangles, once with background and once with background-color.
| -------------------------------------------- |
| Page | Safari 7.0.1 | Chrome 33 |
| -----------------|-------------------------- |
| background | 44.9ms | 34.45ms |
| -----------------|-------------------------- |
| background-color | 87.5ms | 69.34ms |
| -------------------------------------------- |
现在,我想 background-color
会更快,正如资源所想的那样:
I thought that when a browser sees background: #000;
, they really see background: #000 none no-repeat top center;
. I don't have a link to a resource here, but I recall reading this somewhere.
什么给了?为什么 background
比 background-color
快?
您链接的 Github 存储库中的要点:
- None of this is super accurate.
- These are local page load times via
file:///
URLs.
- Nothing is averaged. This is a single page load.
- The only platform tested is OS X (currently 10.9.1).
- I'm no developer tools expert (in any browser).
- Firefox's dev tools are horrible to use and I haven't included them in testing for now.
除非您在不同的浏览器(及其版本)和各种不同机器上的操作系统上重复测试数千次甚至数十万次,否则结果毫无意义。在一个测试实例中,不同浏览器上的加载时间之间存在相关性可能完全是巧合。
此外,这是一个非常具体的测试。它在 OS X 上测试 Safari 7.0.1 和 Chrome 33。Safari 5.1、6、7.0.0 怎么样? Chrome 4、33、44 呢? Firefox、Opera 和 Internet Explorer 怎么样? Windows 或 Linux 呢?那么移动设备呢?
你的问题不是'why is background
faster than background-color
',你的问题是'why did one test run on OS X show background
being faster than background-color
on a specific version of two different browsers'。这是一个有无数种可能性的问题。
我想知道这个,经过一番挖掘,发现 this resource, linked in this answer。
资源状态:
Background vs background-color
Comparison of 18 color swatches rendered 100 times on a page as small rectangles, once with background and once with background-color.
| -------------------------------------------- | | Page | Safari 7.0.1 | Chrome 33 | | -----------------|-------------------------- | | background | 44.9ms | 34.45ms | | -----------------|-------------------------- | | background-color | 87.5ms | 69.34ms | | -------------------------------------------- |
现在,我想 background-color
会更快,正如资源所想的那样:
I thought that when a browser sees
background: #000;
, they really seebackground: #000 none no-repeat top center;
. I don't have a link to a resource here, but I recall reading this somewhere.
什么给了?为什么 background
比 background-color
快?
您链接的 Github 存储库中的要点:
- None of this is super accurate.
- These are local page load times via
file:///
URLs.- Nothing is averaged. This is a single page load.
- The only platform tested is OS X (currently 10.9.1).
- I'm no developer tools expert (in any browser).
- Firefox's dev tools are horrible to use and I haven't included them in testing for now.
除非您在不同的浏览器(及其版本)和各种不同机器上的操作系统上重复测试数千次甚至数十万次,否则结果毫无意义。在一个测试实例中,不同浏览器上的加载时间之间存在相关性可能完全是巧合。
此外,这是一个非常具体的测试。它在 OS X 上测试 Safari 7.0.1 和 Chrome 33。Safari 5.1、6、7.0.0 怎么样? Chrome 4、33、44 呢? Firefox、Opera 和 Internet Explorer 怎么样? Windows 或 Linux 呢?那么移动设备呢?
你的问题不是'why is background
faster than background-color
',你的问题是'why did one test run on OS X show background
being faster than background-color
on a specific version of two different browsers'。这是一个有无数种可能性的问题。