speedscope
Ruby Tests Profiling Toolbox
speedscope | Ruby Tests Profiling Toolbox | |
---|---|---|
5 | 7 | |
5,222 | 1,793 | |
- | 0.6% | |
7.0 | 7.8 | |
20 days ago | 5 days ago | |
TypeScript | Ruby | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
speedscope
-
Speeding up the JavaScript ecosystem – Polyfills gone rogue
Glad to hear you like it! Those flame graph screenshots are taken from https://www.speedscope.app/ .
- Speedscope (An Interactive Flamegraph Visualizer)
-
Speeding up the JavaScript ecosystem - one library at a time
Looks like speedscope. https://www.speedscope.app/
-
A Trick For Reading Flamegraphs
Flamegraphs simply visualize this process by placing each of these recorded stacks side by side. The resulting visualization looks like "flames", hence a "flame graph". If you do this visualization where the "parent" of all the stack frames is on the top, rather than the bottom, you get a "waterfall graph", because it looks like a waterfall. It's the same thing though. Speedscope and DevTools visualize using the waterfall format, but I still call them flamegraphs anyway.
-
Performance Profiling a Mongoid Issue Using AppProfiler
While doing research on Ruby profiling I found Shopify's blog post on "How to Fix Slow Code in Ruby". Though the entire post was extremely insightful, it lead me to Shopify's app_profiler library, which can be used to automatically profile code and redirect the output to a local instance of speedscope. Having worked previously with Flame Graphs of CPU stack traces collected using perf.
Ruby Tests Profiling Toolbox
-
Must-have gems for mature Rails
gem "test-prof" - https://github.com/test-prof/test-prof | Toolkit for inspecting and optimising your test-suite, a must-have.
-
Measuring load time on fixtures
You might be able to do something with https://test-prof.evilmartians.io, but I'm not sure it has anything specific to fixtures out of the box. Maybe using the event profiler on sql.active_record events would be close enough. In the limit, you could wire together your own ActiveSupport::Notifications.instrument around the relevant blocks + an ActiveSupport::Notifications.subscribe to that event so as to log the relevant information. Docs: https://api.rubyonrails.org/classes/ActiveSupport/Notifications.html
-
How to optimize factory creation.
To have a better vision of what objects are created in our spec file we can use test-prof, a powerful gem that provides a collection of different tools to analyse your test suite performance. One of this tool is really useful to identify a factory cascade, let’s introduce factory profiler.
-
A Trick For Reading Flamegraphs
TestProf can be used to get flamegraphs for Ruby test suites.
- How to improve a test suit made with Rspec, Capybara, FactoryBot and Siteprism
-
Does pytest break a lot of coding rules?
Rspec has spec_helper.rb.
-
Learning resources to broaden the knowledge
I also love the test-prof documentation, there's a lot of good ideas on how to improve test performance.
What are some alternatives?
FlameGraph - Stack trace visualizer
DuckRails - Development tool to mock API endpoints quickly and easily (docker image available)
stackprof - a sampling call-stack profiler for ruby 2.2+
Spinach - Spinach is a BDD framework on top of Gherkin.
Microsoft-Performance-Tools-Linux-Android - Linux, Android and Chromium Performance Tools built using the Microsoft Performance Toolkit. Cross-platform .NET Core + WPA GUI
minitest - minitest provides a complete suite of testing facilities supporting TDD, BDD, mocking, and benchmarking.
app_profiler - Collect performance profiles for your Rails application.
timecop - A gem providing "time travel", "time freezing", and "time acceleration" capabilities, making it simple to test time-dependent code. It provides a unified method to mock Time.now, Date.today, and DateTime.now in a single call.
nolyfill - Speed up your package installation process, reduce your disk usage, and extend the lifespan of your precious SSD.
factory_bot - A library for setting up Ruby objects as test data.
eslint-plugin-import - ESLint plugin with rules that help validate proper imports.
faker - A library for generating fake data such as names, addresses, and phone numbers.