Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!fas-news.harvard.edu!newspump.wustl.edu!news.ecn.bgu.edu!news.moneng.mei.com!howland.reston.ans.net!torn!nott!cunews!dbuck
From: dbuck@superior.carleton.ca (Dave Buck)
Subject: Re: Smalltalk performance
X-Nntp-Posting-Host: superior.carleton.ca
Message-ID: <DCrtKv.76A@cunews.carleton.ca>
Sender: news@cunews.carleton.ca (News Administrator)
Organization: Carleton University, Ottawa, Canada
References: <DCqvup.n43@uquebec.ca>
Date: Fri, 4 Aug 1995 05:22:07 GMT
Lines: 34

In article <DCqvup.n43@uquebec.ca>, Benoit Desrosiers  <desrosie> wrote:
>My question is: in the publicity for VW, they write that VW can be almost
>as fast as C or C++, then why is it 20 times slower? Is it me who is wrong?
>Did I hit a area where VW is particulary slow (loops with simple arithmetic)?

You have to be very careful when doing benchmarks like this.  I'm
willing to bet that C and C++ completely optimized out the loop since
the statements in the loop didn't have any side effects.  If you want
to run a fair test, you have to do an operation which C can't optimize
out.

I'd suggest that you look at the assembly language produces by the C
compiler to see what code it generated.  If you want a fair test, try
something like this:

   int i, j, k;
   j = 10;
   k = 5;
   for (i=0; i<10000; i++) {
      j = j * k / 5;
      }

A C compiler wouldn't normally be able to optimize out the loop in
this case.

David Buck
dbuck@ccs.carleton.ca

_________________________________
| David K. Buck                 |
| dbuck@ccs.carleton.ca         |
| The Object People             |
|_______________________________|

