SamSaffron / flamegraph

Flamegraph profiling support for Ruby 2.0
MIT License
382 stars 36 forks source link

Fix fontSize performance #2

Closed felixbuenemann closed 10 years ago

felixbuenemann commented 10 years ago

Only call expensive getBBox method if needed. This reduces execution time for the rails-startup example from 1m20s to 6.5s (measured in Safari 7.01).

felixbuenemann commented 10 years ago

Btw. I would probably remove the text overlay on the flamegraph rectangles completely, because they usually aren't really readable. I think the text shown below the flamegraph is sufficient. Doing so cuts the execution time for the rails-startup example to 3.5s. Unless your way zoomed in, this code does only burn cpu cycles.

I also discovered that replacing opacity with fill-opacity in mouseover and mouseout results in much faster drawing of the hover effect on the demo example.

SamSaffron commented 10 years ago

I like this PR, nice, thanks!

I find the text overlay very useful when I am zoomed in, but really wish we also had a nice hover box that is next to it.

In my ideal world:

  1. You hover on a frame
  2. Box pops up with info about it, close to mouse
  3. With one click you can navigate to source if you would like and highlight similar frames
felixbuenemann commented 10 years ago

Using a tooltip seems like a good idea. I guess it would be possible to store it in an attribute on the svg node and display it on hover. That would be much faster and avoid the small fontsize.