-
Notifications
You must be signed in to change notification settings - Fork 784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How Do People Profile Mruby Code? #3245
Comments
Here's an update since no one else pointed it out: After stumbling across the mruby-profiler gem and using it for some optimization work I ended up summarizing some of my notes taken while getting used to the profiler. mruby-profiler isn't perfect by any means, but it's certainly the best option I've seen for dealing with the ruby side of a mruby powered codebase. |
Hmm, that's a great article, thanks for contributing that. Maybe we really should write a mruby book on wikibooks or so... |
@beoran I personally don't have enough time to invest in something akin to a fully populated wikibook. I'd suggest keeping stuff at a smaller scale targeting trickier subjects. IMO these sorts of topics are best covered either with the guides shipped in the mruby src or in medium length blog style articles. |
stumbled about your article, the gem is sadly broken cause mruby changed too much internally for it to still work. i would really like to be able to profile mruby and c extension code, but its sadly not possible it seams anymore. |
Poking around the mruby-profiler repo for an hour or so, I can get it to spit out opcode sequences along with hit rates. So, while it doesn't look like it would be an entirely trivial effort, it should be possible to resurrect that specific gem to get the same type of output that was previously available. |
As the topic asks, what methods do people use to profile their mruby code (in particular the ruby portion, not the C bits)?
I've got a reasonably large project mruby with ~17k-50k lines of ruby (depending upon how it's measured) and ~4.5k lines of C in addition to the mruby+other-mruby-gems used. I'm trying to use this for a user interface which needs to be responsive and optimizing the ruby side is rather tricky IMO.
Most of my ruby based optimizations have been guessing as to what's the problem, creating a test script, adding Time.new calls to see how long the test takes, and trying optimizations to lower the total run time. Ideally this would be replaced by some sort of instrumentation based profiling, but I'd be happy to have a basic sampling profiler. A sampling would catch a ton of the time where the program was sleeping due to frame limits, but that ought to be easy enough to work around.
So, is there a way to easily instrument mruby code built in?
are there any gems which tackle this problem?
does anyone have any external tool or mruby patches which making profiling easier?
The text was updated successfully, but these errors were encountered: