tmm1 / rbtrace

like strace, but for ruby code
MIT License
1.71k stars 65 forks source link

Add --shapesdump flag #89

Closed casperisfine closed 1 year ago

casperisfine commented 1 year ago

ObjectSpace.dump_shapes was added in 3.2, it works like dump_all but only dumps the shapes, so it's much much faster.

It's very useful to optimize Ruby 3.2.

cc @SamSaffron

SamSaffron commented 1 year ago

looks cool to me, should we only show / handle this option on Ruby 3.2 and up ... or is this going to complicate arg parsing etc... too much?

casperisfine commented 1 year ago

Hum, I don't think it would be particularly hard, it's just a couple if RUBY_VERSION >=

That said, that's the version of the rbtrace client, maybe the process you attach to does have it.

Ultimately I don't think it's a big deal overall. Maybe we could just return a cleaner error if that method isn't defined?

SamSaffron commented 1 year ago

K ... yeah maybe we just clean up the error... will merge for now.

If we could add something to our readme pointing people at what to do with the shapedump (some blog post or something) it would be amazing.

casperisfine commented 1 year ago

(some blog post or something)

I don't know of yet yet, but I'm likely to write one one day.

In the meantime https://github.com/Shopify/heap-profiler will parse shapes dump and produce a top edge list.