有没有办法限制javascript性能来模拟慢客户端 [英] Is there a way to throttle javascript performance to simulate a slow client
问题描述
我正在使用jQuery的网站上工作,并且使用 $(document).ready()
运行相当数量的javascript。在我的开发机器上,一切运行都很棒,但它是一台非常强大的机器。我收到了人们使用旧硬件行为的报告,这看起来很奇怪,而且我相信这是在较慢的机器上处理这个初始javascript所花费的时间。
I am working on a site that uses jQuery and has a fair amount of javascript that is run using $(document).ready()
. On my dev machine everything runs great but it's a pretty powerful machine. I have had reports from people using older hardware of behavior that seems strange and I am fairly convinced that it is down to the time taken to process this initial javascript on slower machines.
显然,解决方案是解决这个初始的javascript,但它让我想知道 - 有没有人知道一种方法来降低Chrome或Firefox中javascript的执行速度,以便能够在我的开发机器上模拟这些较慢的客户端?
Clearly, the solution is to sort out this initial javascript but it got me wondering - does anyone know of a way to slow down the execution speed of javascript in either Chrome or Firefox to be able to simulate these slower clients on my dev machine?
干杯!
更新:
回到这个问题发布时,今天的工具集并不相同。那时VM选项是最佳选择,因此我将其作为已接受的答案。然而,这些天我会直接使用Chrome开发工具,而不是Oded Niv建议
Update: Back when this question was posted, there weren't the same set of tools that there are today. At that time the VM option was the best option therefore I am leaving it as the accepted answer. However these days I would go straight for Chrome dev tools instead as suggested by Oded Niv
推荐答案
这可能不是最好的解决方案,但是可以定义工作的是运行虚拟机,只要它们低于真实机器,就可以指定所有硬件规格。
请参阅这篇文章
This might not be the best solution, but something that could definetely work is to run a virtual machine, there you could specify all hardware specs as long as they are lower than you real machine. Look at this post
这篇关于有没有办法限制javascript性能来模拟慢客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!