Back
I want to compare the time of execution Post.all and SELECT * FROM posts (or some other statements) How can I get the execution time of Post .all?
Try using the code given below:
timing = Benchmark.measure { Post.all }
The various attributes of the object returned (Benchmark::Tms) are mentioned here:
https://ruby-doc.org/stdlib-2.0.0/libdoc/benchmark/rdoc/Benchmark/Tms.html
1.2k questions
2.7k answers
501 comments
693 users