GithubHelp home page GithubHelp logo

Comments (4)

SamSaffron avatar SamSaffron commented on June 16, 2024

view rendering should be there, the middleware intercepts it.

On Sun, Oct 20, 2013 at 2:10 AM, Jørgen Orehøj Erichsen <
[email protected]> wrote:

Great project - keep up the good work [image: 👍]

I tried out the flamegraph option on my Rails project, but apparently it
did not show any view related informations? Just the controller stuff as
well as Rails stuff.

Anybody else experiencing this?

Or maybe I'm misunderstanding what to look for stack trace wise :-)


Reply to this email directly or view it on GitHubhttps://github.com//issues/14
.

from rack-mini-profiler.

SamSaffron avatar SamSaffron commented on June 16, 2024

hmmm it should be there, can you include some screenshots and perhaps a support topic on http://community.miniprofiler.com/

from rack-mini-profiler.

dv avatar dv commented on June 16, 2024

@SamSaffron I'd like to reopen this back up because I think I have a similar issue as @joerichsen.

I have a trivial action that without flamegraph takes 15 seconds to render, and with flamegraph only 400ms. Since I want to investigate why the action takes 15 seconds using the flamegraph, this renders miniprofiler useless for this specific case.

Logs that show timing difference:

I, [2021-04-06T13:05:41.024073 #98211]  INFO -- : [b94940ec-ab99-4b2d-a5f6-616d61ed568d] Started GET "/slow" for 127.0.0.1 at 2021-04-06 13:05:41 +0300
I, [2021-04-06T13:05:41.025259 #98211]  INFO -- : [b94940ec-ab99-4b2d-a5f6-616d61ed568d] Processing by TestController#slow as HTML
I, [2021-04-06T13:05:55.699786 #98211]  INFO -- : [b94940ec-ab99-4b2d-a5f6-616d61ed568d]   Rendered test/slow.html.erb within layouts/application (Duration: 14667.4ms | Allocations: 680526)
I, [2021-04-06T13:05:55.701200 #98211]  INFO -- : [b94940ec-ab99-4b2d-a5f6-616d61ed568d]   Rendered layout layouts/application.html.erb (Duration: 14668.9ms | Allocations: 681225)
I, [2021-04-06T13:05:55.701473 #98211]  INFO -- : [b94940ec-ab99-4b2d-a5f6-616d61ed568d] Completed 200 OK in 14676ms (Views: 14670.4ms | Allocations: 683439)
I, [2021-04-06T13:05:57.807578 #98211]  INFO -- : [a614bff9-8260-489d-b1e4-b70997506efb] Started GET "/slow?pp=flamegraph" for 127.0.0.1 at 2021-04-06 13:05:57 +0300
I, [2021-04-06T13:05:57.808354 #98211]  INFO -- : [a614bff9-8260-489d-b1e4-b70997506efb] Processing by TestController#slow as HTML
I, [2021-04-06T13:05:57.808516 #98211]  INFO -- : [a614bff9-8260-489d-b1e4-b70997506efb]   Parameters: {"pp"=>"flamegraph"}
I, [2021-04-06T13:05:58.311081 #98211]  INFO -- : [a614bff9-8260-489d-b1e4-b70997506efb]   Rendered test/slow.html.erb within layouts/application (Duration: 501.7ms | Allocations: 480023)
I, [2021-04-06T13:05:58.311576 #98211]  INFO -- : [a614bff9-8260-489d-b1e4-b70997506efb]   Rendered layout layouts/application.html.erb (Duration: 502.2ms | Allocations: 480284)
I, [2021-04-06T13:05:58.311814 #98211]  INFO -- : [a614bff9-8260-489d-b1e4-b70997506efb] Completed 200 OK in 503ms (Views: 502.6ms | Allocations: 480723)
I, [2021-04-06T13:07:35.187418 #98211]  INFO -- : [c428fbcf-d245-43d8-b3bb-7171775cb782] Started GET "/slow" for 127.0.0.1 at 2021-04-06 13:07:35 +0300
I, [2021-04-06T13:07:35.188532 #98211]  INFO -- : [c428fbcf-d245-43d8-b3bb-7171775cb782] Processing by TestController#slow as HTML
I, [2021-04-06T13:07:47.667002 #98211]  INFO -- : [c428fbcf-d245-43d8-b3bb-7171775cb782]   Rendered test/slow.html.erb within layouts/application (Duration: 12477.6ms | Allocations: 680077)
I, [2021-04-06T13:07:47.667550 #98211]  INFO -- : [c428fbcf-d245-43d8-b3bb-7171775cb782]   Rendered layout layouts/application.html.erb (Duration: 12478.2ms | Allocations: 680338)
I, [2021-04-06T13:07:47.667892 #98211]  INFO -- : [c428fbcf-d245-43d8-b3bb-7171775cb782] Completed 200 OK in 12479ms (Views: 12478.6ms | Allocations: 680761)

Setup:
A brand new Rails app from rails main (7.0.0.alpha), almost nothing changed except miniprofiler and:

# app/views/test/slow.html.erb
<% @test_runs.times do %>
  <%= render partial: 'layouts/partial' %>
<% end %>

# app/views/layouts/_partial.html.erb
.

# app/controllers/test_controller.rb
class TestController < ApplicationController
  before_action { @test_runs = 10000 }

  def slow
  end

  def fast
  end
end

# config/routes.rb
Rails.application.routes.draw do
  # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
  get "slow", to: "test#slow"
  get "fast", to: "test#fast"
end

The flamegraph itself also shows ~500ms runtime:

When testing it out with flamegraph enabled and in development mode, it looks like partial renderings aren't executed (0.0ms duration)

# ...
  Rendered layouts/_partial.html.erb (Duration: 0.0ms | Allocations: 19)
  Rendered layouts/_partial.html.erb (Duration: 0.0ms | Allocations: 19)
  Rendered layouts/_partial.html.erb (Duration: 0.0ms | Allocations: 19)
  Rendered layouts/_partial.html.erb (Duration: 0.0ms | Allocations: 19)
  Rendered layouts/_partial.html.erb (Duration: 0.0ms | Allocations: 19)
# ...

While without flamegraph there's a definite cost to each partial:

# ...
  Rendered layouts/_partial.html.erb (Duration: 0.8ms | Allocations: 39)
  Rendered layouts/_partial.html.erb (Duration: 1.1ms | Allocations: 39)
  Rendered layouts/_partial.html.erb (Duration: 1.0ms | Allocations: 39)
  Rendered layouts/_partial.html.erb (Duration: 0.8ms | Allocations: 39)
  Rendered layouts/_partial.html.erb (Duration: 0.7ms | Allocations: 39)
# ...

from rack-mini-profiler.

dv avatar dv commented on June 16, 2024

Ah, it appears as of miniprofiler itself is causing the delay. Probably enabling the flamegraph disables the miniprofiler code. If I pull miniprofiler entirely, I get the same results as the flamegraph timings.

So this can remain closed! But I hope my explanation is useful for the next internaut stumbling on this.

from rack-mini-profiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.