Re: Frequency of integer division in source code?

tfj@apusapus.demon.co.uk (Trevor Jenkins)Thu, 10 Feb 1994 22:36:29 GMT

From comp.compilers

Related articles
Frequency of integer division in source code? Peter-Lawrence.Montgomery@cwi.nl (1994-02-07)
Re: Frequency of integer division in source code? hbaker@netcom.com (1994-02-08)
Re: Frequency of integer division in source code? meissner@osf.org (1994-02-09)
Re: Frequency of integer division in source code? tfj@apusapus.demon.co.uk (1994-02-10)
Re: Frequency of integer division in source code? glew@ichips.intel.com (1994-02-11)
Re: Frequency of integer division in source code? bazyar@netcom.com (1994-02-10)
Re: Frequency of integer division in source code? cliffc@dawn.cs.rice.edu (1994-02-14)
Re: Frequency of integer division in source code? chase@Think.COM (1994-02-15)
Re: Frequency of integer division in source code? pardo@cs.washington.edu (1994-02-17)
| List of all articles for this month |

 Newsgroups: comp.compilers From: tfj@apusapus.demon.co.uk (Trevor Jenkins) Keywords: architecture, optimize Organization: Don't put it down; put it away! References: 94-02-058 Date: Thu, 10 Feb 1994 22:36:29 GMT

meissner@osf.org writes:
>Another place where division (actually modulus) is used quite
>frequently is in calculating hash tables, which often involves modulus
>by a prime number constant. This of course lends itself nicely to
>being replaced by multiplication.

Better yet is not to be mis-lead by Maurer's paper and to ignore his
advice by using a table whose size is a power of two. Then the integer
divide becomes an AND operation which is faster that division or
multiplication on almost all architectures.

The ``theory'' of using powers of two is explained in various papers by
Hopgood et all from the late-60/early-70s.

--
Regards, Trevor.
---------------------------------------------------------------------------
Trevor Jenkins
134 Frankland Rd, Croxley Green, RICKMANSWORTH, WD3 3AU, England
email: tfj@apusapus.demon.co.uk phone: +44 (0)923 776436 radio: G6AJG
--

Post a followup to this message