网页允许的最大div数 [英] Maximum number of divs allowed in web page

查看:155
本文介绍了网页允许的最大div数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我想知道网页上允许的div数量是否有限制?

例如,当Internet Explorer需要渲染一个拥有一千个div的网页时,它才会开始窒息?

>解决方案

我知道这是一个旧帖子,但我最近做了一个与这个主题直接相关的测试,我想分享我的结果。



我创建了一个简单的php脚本,它将5px x x 5px的inline-block div分配给测试浏览器稳定性和页面滚动能力。



IE9,Firefox和Chrome在页面上的1000 div处没有任何问题,甚至在滚动时也不会出现打嗝。
$ b 在10,000 div处,IE9和Chrome浏览器能够以几乎明显的延迟进行滚动,仍在我书中的可接受范围内,但是Firefox开始滞后得更为明显,直到您感觉到滚动条在比应该延迟半秒钟的位置更快地移动到位。

有趣的是,10,000 div和100,000之间的表现差异并不像您想象的那么激烈。 IE9和Chrome的执行速度只有几乎察觉不到的延迟(Chrome是两者中稍微平滑的),而且Firefox有一个非常明显的延迟,可能会被认为是令人讨厌的,但仍然功能相当好(即, t崩溃)。

现在在页面上有500,000个div,它终于开始变得有趣了。 IE9崩溃并尝试重新启动(当然在同一页面上),并再次崩溃,此时我正确关闭它,重新启动它,并再次尝试一次,以确保再次发生相同的结果。它做了。

Chrome保持稳定,但由于极度延迟,滚动页面变得几乎不可能。

令人惊讶的是Firefox,浏览器在100,000 div下大致相当于500,00 div ...滚动并不顺利,但它是比Chrome更好。



令人惊讶的是,结果与一页上1,000,000个div几乎相同! Firefox在不崩溃的情况下处理它们,尽管矮胖仍然可以滚动。 IE9坠毁。 Chrome能够加载页面,但速度很慢,几乎无法使用。

我知道这不完全是一项科学研究,但我认为除了我自己之外,其他人可能会感兴趣。

测试是在配备Dual-Xeon处理器的戴尔工作站和4个ram运行的Windows 7上进行的。


Hi I was wondering if there is a limit to the number of divs that are allowed on a web page?

For example will Internet Explorer start to choke when it has to render a webpage with a thousand divs?

解决方案

I know this is an old post, but I recently did a test that is directly related to this topic and I wanted to share my results.

I created a simple php script that spits out x number of 5px by 5px inline-block divs to test browser stability and page scroll-ability.

At 1000 divs on the page IE9, Firefox, and Chrome have no problem whatsoever and don't even seem to hiccup when scrolling.

At 10,000 divs IE9 and Chrome are able to scroll with a barely-noticeable delay, still within the 'acceptable' range in my book, however Firefox begins to lag more noticeably, to the point where you feel the scroll bar is jumping into position a half-second later than it should.

Interestingly, the performance difference between 10,000 divs and 100,000 is not as drastic as you'd imagine. IE9 and Chrome perform with only a barely perceptible delay in scrolling (with Chrome being the slightly smoother of the two), and Firefox has a delay that is very noticeable and would probably be considered annoying, but still functions reasonably well (i.e. it doesn't crash).

Now at 500,000 divs on the page it finally started to get interesting. IE9 Crashed and tried to restart itself (on the same page, of course) and crashed again, at which point I shut it down properly, restarted it, and tried one more time to make sure the same result would happen again. It did.

Chrome remained stable, but it became nearly impossible to scroll the page due to the extreme delay.

The big surprise was Firefox, the browser that was chunky at 100,000 divs is just about the same at 500,00 divs ... scrolling is not smooth, but it is way, way better than Chrome.

Amazingly, the results were pretty much the same for 1,000,000 divs on a page! Firefox handled them without crashing and remained scrollable though 'chunky'. IE9 crashed. And Chrome was able to load the page but became so slow that it was virtually unusable.

I know this isn't exactly a scientific study, but I figured it might be interesting to someone else besides myself.

Tests were performed on a Dell workstation with Dual-Xeon processors and 4 gigs of ram, running Windows 7.

这篇关于网页允许的最大div数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆