Message-ID: <31FEF513.60E7@3-cities.com>
Date: Tue, 30 Jul 1996 22:54:27 -0700
From: Travis Griggs <tkc@3-cities.com>
Reply-To: tkc@3-cities.com
X-Mailer: Mozilla 2.02 (Macintosh; I; PPC)
MIME-Version: 1.0
Newsgroups: comp.lang.smalltalk
Subject: Re: Measurement of Smalltalk methods
References: <4tkkvc$fth@zdi.informatik.uni-stuttgart.de> <4tkvkm$nv2@loki.tor.hookup.net>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: bigtca110.3-cities.com
Lines: 57
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!CTCnet!info.ucla.edu!agate!spool.mu.edu!usenet.eel.ufl.edu!news-res.gsl.net!news.gsl.net!swrinde!newsfeed.internetmci.com!newsreader.sprintlink.net!news.sprintlink.net!news-fw-12.sprintlink.net!netnews.nwnet.net!204.203.224.159!

Dennis Smith wrote:
> 
> In article <4tkkvc$fth@zdi.informatik.uni-stuttgart.de>, li@informatik.uni-stuttgart.de (li jinhua) wrote:
> >Smalltalkers,
> >
> >        does someone know a way to measure or compare the execution
> >speed of Smalltalk programs?
> >        Let us say to compare two methods to find an element from a
> >large Collection: one implements the collection in Set, the another
> >in OrderedCollection. I think the former, that is, the collection
> >impemented in Set is faster, since a Set finds an element using hash
> >method.
> >
> >BTW: I use VW2.0 under SUN Solaris.
> >
> >Thanks in advance.
> >
> >Jinhua
> 
> You have two choices under VW.
> In either case, you need to be able to run the method(s)
> multiple times to get meaningful data.
> 
> The simplest is to use:
> 
>         Time millisecondsToRun: [aBlk]
> 
> where "aBlk" runs your method(s).  Put this in
> a workspace, and "printIt".  The result will
> be the time (in milliseconds) that "aBlk" took to
> run.  Try and get up into a few seconds if possible.
> Do this on each method you want to compare.
> 
> The other thing you can do is use the Advanced Tools
> Profiler.  This of course profiles everything, so you might
> want to use this on something bigger than one
> method.  Its about as simple:
> 
>         TimeProfiler new profile: [aBlk]
> 
You still want to make sure that iterate through your code (be it a 
large OR small chunk of code multiple times), i.e.

      TimeProfiler new profile: [someNumber timesRepeat: [testCode]]

Another tool, which may not seem obvious for use at first is the 
AllocationProfiler. I can think of at least one instance, where using 
the TimeProfiler was not too revealing. It seemed that the code was for 
the most part running with primitives. But upon using the 
AllocationProfiler, we found that we were creating way to many darn 
objects, regardless of whether the code was mostly virtual machine 
primitives or not. We twiddled with the approach and ended up with less 
percentage of the code running in primitives as reported by the 
TimeProfiler, but overall execution time was much faster!


-- 
Travis Griggs
tkc@3-cities.com
(509) 943-4210
