Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Perfomance tuning

Reply
Thread Tools

Perfomance tuning

 
 
Emil Sandin
Guest
Posts: n/a
 
      03-13-2007
Hi,
I have an application that takes a little to long to execute. I would
like to know where I could gain most.

Whenever a metod is called, I would like to store the execution time and
number of executions. Then, at the end of the applications execution,
print it out. Something like:

Object1 =>
method1 => called 10 times, 30 milliseconds total time
method2 => called 1 times, 5 milliseconds total time
Object2 =>
method1 => called 1 times, 2 milliseconds total time
method2 => called 30 times, 500 milliseconds total time
...

How would I do this?
Regards
Emil

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
A.S. Bradbury
Guest
Posts: n/a
 
      03-13-2007
On 3/13/07, Emil Sandin <(E-Mail Removed)> wrote:
> Hi,
> I have an application that takes a little to long to execute. I would
> like to know where I could gain most.


The best way is ruby-prof (http://ruby-prof.rubyforge.org). It will
generate ascii or html formatted output showing the time spent in
methods. See http://www.oreillynet.com/ruby/blog/...ith_rubyp.html
for links to a series of 3 blog posts describing its use.

Alex

 
Reply With Quote
 
 
 
 
Alex Young
Guest
Posts: n/a
 
      03-13-2007
Emil Sandin wrote:
> Hi,
> I have an application that takes a little to long to execute. I would
> like to know where I could gain most.
>
> Whenever a metod is called, I would like to store the execution time and
> number of executions. Then, at the end of the applications execution,
> print it out. Something like:
>
> Object1 =>
> method1 => called 10 times, 30 milliseconds total time
> method2 => called 1 times, 5 milliseconds total time
> Object2 =>
> method1 => called 1 times, 2 milliseconds total time
> method2 => called 30 times, 500 milliseconds total time
> ...
>
> How would I do this?


Investigate 'profile' in the standard library
(http://www.rubycentral.com/book/trouble.html) or ruby-prof
(http://ruby-prof.rubyforge.org/). Both do what you want, but the
latter is more comprehensive.

--
Alex

 
Reply With Quote
 
Emil Sandin
Guest
Posts: n/a
 
      03-13-2007
Thank you for your quick replies, I will look into this at once.

/Emil

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't listen audio/realone files while tuning MSN Tuning vizard working Thaqalain Computer Support 5 10-22-2005 09:06 PM
CreateInstranceAndUnwrap slow perfomance Gnanaprakash Rathinam ASP .Net 5 12-30-2004 09:18 PM
Server perfomance Fredrik Melin ASP .Net 1 10-27-2004 11:45 AM
perfomance an ip-route-cache on a router Ralf Huelsmann Cisco 1 08-15-2004 03:09 PM
Optimizing perfomance on T3 line Christoph Schad Cisco 12 01-01-2004 08:40 PM



Advertisments