Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6939025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:33:58+00:00 2026-05-27T12:33:58+00:00

I want to improve performance of my app, and started reading http://guides.rubyonrails.org/performance_testing.html . My

  • 0

I want to improve performance of my app, and started reading http://guides.rubyonrails.org/performance_testing.html. My questions are at the end of this “how I started” speach.

So I started simple with

class BrowsingTest < ActionDispatch::PerformanceTest
  self.profile_options = { :runs => 5, :metrics => [:wall_time, :process_time],
                       :output => 'tmp/performance', :formats => [:flat] }
  def test_homepage
    get '/'
  end
end

the output of

bundle exec rake test:profile

in the terminal is

BrowsingTest#test_homepage (909 ms warmup)
           wall_time: 341 ms
        process_time: 517 ms

and in process_time flat file, it starts like that

Thread ID: 70299857145540
Total: 2.589931

 %self     total     self     wait    child    calls  name
 12.45      0.32     0.32     0.00     0.00      110  BasicObject#method_missing
 10.59      0.28     0.27     0.00     0.01      415  Kernel#raise
  7.79      0.20     0.20     0.00     0.00     1350  <Class::Dir>#[]

Not really knowing what to do with that, I started by looking for something that uses method_missing a lot. I found that a lib I’m using to convert metrics (Alchemist) does that and includes itself in the Numeric class.

Since the homepage doesn’t really need that, I just removed the lib and re-ran the profiling test.
This time I got the following

BrowsingTest#test_homepage (856 ms warmup)
           wall_time: 321 ms
        process_time: 482 ms

And the flat file didn’t have method_missing anymore

Thread ID: 70185893711560
Total: 2.420023

 %self     total     self     wait    child    calls  name
 12.05      0.29     0.29     0.00     0.00        5  ActionView::Base#helpers
  8.32      0.20     0.20     0.00     0.00     1350  <Class::Dir>#[]
  5.12      0.12     0.12     0.00     0.00     5925  String#gsub

I ran it a second time and got

BrowsingTest#test_homepage (856 ms warmup)
           wall_time: 321 ms
        process_time: 482 ms

Thread ID: 70231460630220
Total: 2.411142

 %self     total     self     wait    child    calls  name
 14.18      1.49     0.34     0.00     1.16     3265  Array#each
  8.26      0.20     0.20     0.00     0.00     1350  <Class::Dir>#[]
  4.94      0.12     0.12     0.00     0.00      205  Kernel#caller

So it seems that not using the library saves ~35ms process time, which seems pretty consistent with what the flat files said. I guess I should try to do something about that, especially since it seems to be called so often because of the Numeric inclusion.

Now here are my questions:

  • Is it the right approach ? Is there a better way to start ?
  • What’s the best way to pinpoint the class/method that’s degrading performance (next step for me would be to look for something using Dir, but there’s more than one places where it’s used)
  • What is an acceptable process time ?
  • I ran the test:profile several times in a row, and the self time for “String#gsub” went from 0.04 to 0.12. What could happen ?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:33:59+00:00Added an answer on May 27, 2026 at 12:33 pm

    I like how you got familiar with the tools and how to read the results. New Relic is great tool for monitoring this stuff, but so is request_log_analyzer if you don’t want to pay for new relic over the long haul.

    1. use Yslow or Page speed to profile your full page, not just the html download
    2. Optimize the page, an how it loads/caches resources
    3. Find your slowest actions and figure out what they are doing (slow code or slow query?)
    4. Optimize queries, add indexes where needed, cache data
    5. Remove or Update old libraries
    6. Offline expensive processes (background, cron jobs, etc)
    7. Tune your architecture (You don’t need Rails for everything, hop on jruby and leverage powerful java libraries, threading and runtime)

    Monitoring is important, so you know when a problem creeps up

    -John McCaffrey

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to improve the performance of my app. One thing which comes to
I'm trying to improve performance of my script. I want to improve this: el.removeClass(
I want to improve the reading performance, so thinking about pre-load the data block
I am working on image processing library in c#. want to improve performance/speed and
To improve performance of our MVC3 application we want to mark some Controller's to
This is my first post in stackoverflow. I want to improve its google pagerank
I have an website and I want to improve it's performance. I've fixed all
We have a SQL Server 2005 database for which we want to improve performance
I want to improve the performance of a specific method inside a larger application.
I want to improve the performance of my application, and found that it spends

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.