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) |
Newsgroups: | comp.compilers |
From: | cliffc@dawn.cs.rice.edu (Cliff Click) |
Keywords: | architecture, optimize |
Organization: | Rice University |
References: | 94-02-058 94-02-070 |
Date: | Mon, 14 Feb 1994 17:12:48 GMT |
meissner@osf.org writes:
>[re modulus for hash tables]
tfj@apusapus.demon.co.uk (Trevor Jenkins) writes:
|> 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.
Personal experience: my hash-table impementation uses power-of-two table
sizes. It doubles the table size when it gets too full. I get good
spread and density: for identitifier + keyword strings from a large
collection of C programs I had 85% of my bins holding 1 key, and no more
than 3 keys in any bin.
I would be more worried about code like:
int offset;
struct foo *a, *b;
...
offset = a - b;
where sizeof(struct foo) is not a power of two.
--
cliffc@cs.rice.edu -- Massively Scalar Compiler Group, Rice University
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.