gpt4 book ai didi

ruby-on-rails - 生成网页的合理时间是多少?

转载 作者:行者123 更新时间:2023-12-04 00:55:20 25 4
gpt4 key购买 nike

我正在开发网络应用程序(基于 Rails 3)。而且我真的不喜欢生成页面所需的时间 - 根据显示的数据,它最多需要 2.5 秒甚至 4 秒。

所以我只是想知道在您的应用程序中生成页面的平均合理时间是多少。假设您检查生成时间,例如它是 750 毫秒,并认为“好吧,即使没有缓存也应该没问题”。或者当您看到 1.5 秒时,您会想“天哪,用户不会等那么久就离开网站”

最佳答案

有大量关于从查询到渲染的时间和用户体验的研究数据。我建议阅读 this useit.com article 。毕竟谷歌在其结果中集成了页面速度是有原因的;)

The 3 response-time limits are the same today as when I wrote about them in 1993 (based on 40-year-old research by human factors pioneers):

  • 0.1 seconds gives the feeling of instantaneous response — that is, the outcome feels like it was caused by the user, not the computer. This level of responsiveness is essential to support the feeling of direct manipulation (direct manipulation is one of the key GUI techniques to increase user engagement and control — for more about it, see our Principles of Interface Design seminar).
  • 1 second keeps the user's flow of thought seamless. Users can sense a delay, and thus know the computer is generating the outcome, but they still feel in control of the overall experience and that they're moving freely rather than waiting on the computer. This degree of responsiveness is needed for good navigation.
  • 10 seconds keeps the user's attention. From 1–10 seconds, users definitely feel at the mercy of the computer and wish it was faster, but they can handle it. After 10 seconds, they start thinking about other things, making it harder to get their brains back on track once the computer finally does respond.

A 10-second delay will often make users leave a site immediately. And even if they stay, it's harder for them to understand what's going on, making it less likely that they'll succeed in any difficult tasks.



根据经验,您应该始终以优化时间与获得的时间之间的平衡为目标。当您的图像未正确压缩或您的脚本/css 未组合时,不要花费数天时间来优化一个程序。是的,越快越好,但是在一周调整算法后,通过设置智能缓存生成页面的 90% yield 超过了 10% 的 yield 。

当框架必须加载所有内容时,也不要过多关注首次渲染时间,而是使用压力测试(无论是否缓存)来模拟各种情况。

现在,一些数据;我工作过的一些最新站点使用了 DotNetNuke,一个巨大的开源 CMS,和 Asp.Net MVC,在那里你更接近金属。对于 DotNetNuke,平均 db 查询的平均页面时间为 600-700 毫秒。对于 Asp.net MVC,它是 70-100 毫秒...用户真的很喜欢第二个 :)

关于ruby-on-rails - 生成网页的合理时间是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3868031/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com