简体   繁体   English

有效的网页加载速度更快吗?

[英]Do valid web pages load faster?

I am a fan of valid web pages and always spend time passing new sites through the W3C validator . 我是有效网页的粉丝,并且总是花时间通过W3C验证器传递新网站。

When trying to make a case for why companies should validate web pages I quickly thought of accesibility and the future-proofing of the web site on more primitive devices such as phones, fridges, watches, the next-big-thing etc. 当试图使为什么企业要验证的网页我灵机一动无障碍环境的情况下,并在较原始的设备如手机,冰箱,手表,下一个大的事情等网站的未来打样

However I then wondered if there is a computational overhead involved in rendering web pages that do not validate? 但是,我想知道渲染网页是否存在计算开销,而这些网页无法验证?

Has there been any research done in this area? 在这方面有没有做过任何研究? and do some browsers handle invalid content better than others? 有些浏览器比其他浏览器更好地处理无效内容吗?

It's likely that an invalid page will take longer to render because the browser will need to implement some fault recovery (deductive work to find where the next valid content is and how the browser can continue rendering it) and this can introduce an overhead. 由于浏览器需要实现一些故障恢复(演绎工作以查找下一个有效内容的位置以及浏览器如何继续渲染),因此无效页面可能需要更长时间才能呈现,这可能会带来开销。

Actual difference can only be told after careful measurements and (if possible) browser source code analysis. 实际差异只能在仔细测量和(如果可能)浏览器源代码分析后告知。

I think your stronger argument will be in maintenance. 我认为你更强有力的论点是维护。 I designed the intranet for the last major company I worked for. 我为我工作的最后一家大公司设计了内联网。 I created page templates that have valid markup and used conditional comments to target stylesheets for different versions of IE. 我创建了具有有效标记的页面模板,并使用条件注释来针对不同版本的IE定位样式表。 The site was launched 2 years ago; 该网站于2年前推出; it looks the same in Firefox 2 & 3, Safari 2 & 3, and IE 6, 7, & 8! 它在Firefox 2&3,Safari 2和3以及IE 6,7和8中看起来都一样! No markup or style changes were necessary. 不需要更改标记或样式。 This means that when the organization finally updates to IE 7, the web developer team will not have to do anything. 这意味着当组织最终更新到IE 7时,Web开发团队将不必执行任何操作。 Big win in reduced maintenance costs. 大大降低了维护成本。

我怀疑任何故障恢复或其他无效内容处理的成本只会因网络延迟和其他成本而忽略不计。

I then wondered if there is a computational overhead involved in rendering web pages that do not validate? 然后我想知道在渲染不验证的网页时是否存在计算开销?

Sure, but it's pretty much minuscule. 当然,但它几乎是微不足道的。 Parsing speed in general won't have a tangible impact, compared to the much larger delays caused by network download time. 与网络下载时间引起的大得多的延迟相比,解析速度通常不会产生实际影响。

Where it can make a difference to load times is when you close a comment incorrectly. 如果错误地关闭评论,它可以对加载时间产生影响。 Fixups for comment problems can be delayed until the end of the page, so progressive rendering won't happen and nothing will render until the whole page is downloaded. 注释问题的修正可以延迟到页面结束,因此不会发生渐进式渲染,并且在下载整个页面之前不会呈现任何内容。

I don't think so. 我不这么认为。 I think it's just about the same, maybe even more for valid pages (things like & in URLs). 我认为这与有效页面(例如URL中的& )之类的内容大致相同,甚至更多。 Especially since some browsers (ahem, IE) are practically designed for invalid pages. 特别是因为一些浏览器(ahem,IE)实际上是为无效页面设计的。 Not to say I like invalid HTML, though. 但并不是说我喜欢无效的HTML。

I'm just speculating here, because I have no reference or hard data to back this up, but I think that the rendering mode that the browser chooses can have quite some impact. 我只是在这里推测,因为我没有参考或硬数据支持这一点,但我认为浏览器选择的渲染模式会产生相当大的影响。 Most browsers have two or three rending modes, one for standard-complient pages (which is usually triggered when you serve the browser a valid html document, but not always), and quirks mode, which simply tries to make the best of whatever you throw at it. 大多数浏览器都有两种或三种渲染模式,一种用于标准兼容页面( 通常在您为浏览器提供有效的html文档时触发,但并非总是如此),以及怪癖模式,它只是试图充分利用您抛出的任何内容在它。 I can imagine that the performance of standards-complient mode is a lot better than that of quirks mode, but again: just speculating here. 我可以想象标准兼容模式的性能比怪癖模式好很多,但同样重要:这里只是推测。 If anyone can back this up with evidence or a good reference, feel free to comment or post a better answer! 如果有人可以通过证据或好的参考来支持,请随时发表评论或发布更好的答案!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM