Javascript 优化 - 面临 GUI 缓慢的问题
我正在开发网络应用程序,其中我在客户端使用 javascript 来处理验证/调用后端 cgi 脚本等。现在我的问题是 WebGUI 变得比以前慢了一些。实际上一切都工作正常,因为但这个问题是预料之中的。 我知道可能有很多问题直接影响应用程序的速度。 毕竟应用程序依赖于 cgi 脚本响应,但仍然有可能通过处理某些 javascript 函数来使应用程序更快? 那么你能否建议我应该采取哪些步骤来使 javascript 执行更快???(即更少的 LOC 数量) 提前致谢...
I am working on web app in which I am using javascript on client side to handle validation/calling backend cgi scripts etc kind of things.Now my problem is the WebGUI has become some what slow than it was earlier.Actually everything is working fine as expected but this issue.
I know that there may be many issues which are directly affecting the speed of application.
After all all the application is depended on cgi script response but still is it possible to make the app faster by taking care of certain javascript functions??
So can you please suggest that what are the steps I should take care to make javascript execution some what faster ???(i.e less number of LOC)
Thanks in advance...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只要你不贴一些js代码,就很难帮助你。
不过,总的来说:将 DOM 操作保持在最低限度,尤其是在处理大量数据时。不要在循环中使用影响 dom 的 jquery 函数(append、insertBefore、insertAfter) - 尝试在循环中完成所有准备工作,然后在完成所有更改后调用影响 DOM 的函数。
但当然,我不知道您的应用程序的任何代码中是否存在这种情况。
As long as you do not post some js code, it will be kind of difficult to help you.
Still, speaking in general: Keep your DOM-Manipulations to a minimum, especially when dealing with lots of data. Do not use jquery functions that affect the dom (append, insertBefore, insertAfter) in a loop - try to do all your preparation in a loop and then call DOM-affecting functions once having all the changes together.
But of course, i do not know if this is the case in any code of your application.