commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hurd/libihash ihash.c priv.h Makefile sizes.c


From: Roland McGrath
Subject: Re: hurd/libihash ihash.c priv.h Makefile sizes.c
Date: Mon, 20 Aug 2001 03:26:00 -0400 (EDT)

> Roland McGrath <address@hidden> writes:
> 
> >     2001-08-15  Roland McGrath  <address@hidden>
> >     
> >     * sizes.c: New file, a list of prime numbers useful for table sizes.
> >     * priv.h (_ihash_sizes, _ihash_nsizes): Declare.
> >     (_ihash_nextprime): Don't.
> >     * ihash.c (ihash_add): Select sizes from the _ihash_sizes array
> >     instead of using _ihash_nextprime.
> >     * Makefile: Clean up whitespace, reorder all the variable definitions.
> >     (SRCS): Remove primes.c, add sizes.c instead.
> >     (OBJS): Define dynamically.
> 
> Why this change?

You can see the thread on bug-hurd that led to it.  For the larger primes,
_ihash_nextprime uses huge amounts of memory for its temporary array.  This
constituted a bug that crashed proc because it was done with stack space.
But it's still an unreasonably large amount of memory even for malloc (I
would have been cursing you for the thrashing if I hadn't recently put 1GB
of RAM in my machine).  Rather than change it to use malloc, change it to
use bits instead of bytes for booleans, or any further consideration of
your silly bit of code that has already consumed too much maintenance time,
I just finally acknowledged its pointlessness instead.  

My version is, uh, smaller and faster, too. ;-)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]