0

I have a typical rails app with partials to load nav bars etc. My mini-profiler shows one of the partials taking way more time to render vs the rest. Can I use mini-profiler to dig into the rendering of these to see where the time being taken up?

enter image description here

My SQL times seem ok but the partials seem to be slowing things down.

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
Dan Tappin
  • 2,692
  • 3
  • 37
  • 77
  • The index makes 7 request; the partial makes two requests. Can you reduce that? And optimize those requests? The profiler guides you to make sure there are improvements, but here is a pattern: More requests often implies slower. – Eric Platon Nov 27 '15 at 22:22
  • I agree but the 2 requests in that +800 ms portion are trivial and it looks like the code it's self is slow. – Dan Tappin Nov 28 '15 at 01:23
  • To answer your question, a profiler can help, sure. Code review is often a first stage before profiling, though. If the queries are trivial, then your code may be doing some expensive processing (any `map` or loop on the result) that may be delegated to the DB. Without the code, this is just speculative, but several processing in Ruby (most languages actually) are way slower than the DB itself, when it can be delegated. – Eric Platon Nov 28 '15 at 01:50
  • I see references to 'probes' for mini-profiler to see for example where a particular part of your code is being executed. I guess this what I would like to start hunting this down. I can take a guess with a manual review but it would be nice to flag the start and stop of a loop, map etc. and narrow the search. I can't seem to find any documentation on this. – Dan Tappin Nov 28 '15 at 02:13
  • Sorry, as I do not know much of mini-profiler. I usually rely on [Ruby Prof](https://github.com/ruby-prof/ruby-prof). Would this tool be of any help? You can quite easily instrument your code. – Eric Platon Nov 29 '15 at 13:54

0 Answers0