Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!oitnews.harvard.edu!purdue!lerc.nasa.gov!magnus.acs.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!torn!nott!cunews!tina.mrco.carleton.ca!knight
From: knight@mrco.carleton.ca (Alan Knight)
Subject: Re: Smalltalk vs C vs C++ benchmark results [Fortran]
X-Nntp-Posting-Host: tina.mrco.carleton.ca
Message-ID: <knight.810307251@tina.mrco.carleton.ca>
Sender: news@cunews.carleton.ca (News Administrator)
Reply-To: knight@mrco.carleton.ca (Alan Knight)
Organization: The Object People
References: <DEDsF1.3I8@cunews.carleton.ca> <42fan7$4fn@news.iastate.edu> <denatale-0409951729270001@grail914.nando.net> <42fthj$95e@news.iastate.edu>
Date: Tue, 5 Sep 1995 13:20:51 GMT
Lines: 23

In <42fthj$95e@news.iastate.edu> rhawkins@iastate.edu (Rick Hawkins) writes:
>>In any event how much code did you spend? 100 // 3 is integer division.

>Not much writing, but a lot in execution.  (a/b) asInteger  was enough
>to do it, but rather than a simple single instruction divide, there
>would be a call to a divide, a cal t a remainder, the creation of a new
>variable to hold the fraction, then another call to asFoat to undo most
>of the work.   The beauty of the object theory gets beat up by the facts
>of acutal compilation.  I could have written a c-function for the
>integer divide, i suppose, but we're getting back to the writing of tons
>of low-level stuff that caused me to flee c++ in the first place.

You don't have to write a C function. What he's saying is that 100 //
3 is integer division. It does what you want without going through
fraction, and probably runs many times faster than (a/b) asInteger. If
you were doing this a lot in your code it makes the 15,000 times
speedup sound more plausible.

-- 
 Alan Knight                | The Object People
 knight@acm.org             | Smalltalk and OO Training and Consulting
 alan_knight@mindlink.bc.ca | 509-885 Meadowlands Dr.
 +1 613 225 8812            | Ottawa, Canada, K2C 3N2
