如何准确基准化模型加载所需的时间? [英] How can I accurately benchmark the time it takes to load a model?

查看:61
本文介绍了如何准确基准化模型加载所需的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想确定加载模块所需的时间(find_by_id(234)调用).

I want to benchmark the time it takes to load a module (a find_by_id(234) call).

此外,我如何跟踪加载页面所需的时间,我知道我在运行Rails Server时获得了此信息,但这是在调试模式下,我希望可以进行生产速度基准测试吗?

Also, how can I track the time it takes to load a page, I know I get this information when I run rails server, but this is in debug mode, I want production speed benchmarks, possible?

推荐答案

为快速查看,我强烈建议您查看

For a quick check, I would highly recommend checking out Benchmark.

一个例子是:

require "benchmark"

time = Benchmark.measure do
  a.find_by_id(234)
end
puts time

但是对于生产级别的基准测试,我会查看 New Relic.他们几乎为您提供了令人难以置信的基准测试的.

However for production level benchmarking, I would check out New Relic. They offer unbelievable benchmarking on nearly everything you could think of.

他们在这里有免费的开发人员模式:

They have a free developer mode here :

http://support.newrelic.com/kb/docs/developer-mode

这篇关于如何准确基准化模型加载所需的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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