106 lines
5.5 KiB
HTML
106 lines
5.5 KiB
HTML
|
<!-- Common Lisp HyperSpec (TM), version 7.0 generated by Kent M. Pitman on Mon, 11-Apr-2005 2:31am EDT -->
|
||
|
<HTML>
|
||
|
<HEAD>
|
||
|
<TITLE>CLHS: Issue HASH-TABLE-SIZE Writeup</TITLE>
|
||
|
<LINK HREF="../Data/clhs.css" REL="stylesheet" TYPE="text/css" />
|
||
|
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
|
||
|
<META HTTP-EQUIV="Organization" CONTENT="LispWorks Ltd.">
|
||
|
<LINK REL=TOP HREF="../Front/index.htm">
|
||
|
<LINK REL=COPYRIGHT HREF="../Front/Help.htm#Legal">
|
||
|
<LINK REL=DISCLAIMER HREF="../Front/Help.htm#Disclaimer">
|
||
|
<LINK REL=PREV HREF="../Issues/iss189_w.htm">
|
||
|
<LINK REL=UP HREF="../Issues/iss190.htm">
|
||
|
<LINK REL=NEXT HREF="../Issues/iss191_w.htm">
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<H1><A REV=MADE HREF="http://www.lispworks.com/"><IMG WIDTH=80 HEIGHT=65 ALT="[LISPWORKS]" SRC="../Graphics/LWSmall.gif" ALIGN=Bottom></A><A REL=TOP HREF="../Front/index.htm"><IMG WIDTH=237 HEIGHT=65 ALT="[Common Lisp HyperSpec (TM)]" SRC="../Graphics/CLHS_Sm.gif" ALIGN=Bottom></A> <A REL=PREV HREF="../Issues/iss189_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss190.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss191_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
||
|
|
||
|
<HR>
|
||
|
|
||
|
|
||
|
|
||
|
<H2>Issue HASH-TABLE-SIZE Writeup</H2>
|
||
|
|
||
|
<PRE><B>Status:</B> Passed, as amended here, Jun 89 X3J13<P>
|
||
|
<B>Issue:</B> <A REL=DEFINITION HREF="../Body/f_hash_4.htm#hash-table-size"><B>HASH-TABLE-SIZE</B></A><P>
|
||
|
<B>References:</B> CLtL p.283<P>
|
||
|
<B>Category:</B> CLARIFICATION<P>
|
||
|
<B>Edit history:</B> Version 1, 20-Mar-89, by Moon<P>
|
||
|
Version 2, 1-Jul-89, by Masinter (per Jun89 X3J13 amendments)<P>
|
||
|
<P>
|
||
|
<B>Problem description:<P>
|
||
|
</B> <P>
|
||
|
CLtL contradicts itself on the meaning of the :SIZE argument to<P>
|
||
|
<A REL=DEFINITION HREF="../Body/f_mk_has.htm#make-hash-table"><B>MAKE-HASH-TABLE</B></A>. At the top of p.283, it says that the size is "the<P>
|
||
|
maximum number of entries it can hold. Usually the actual capacity of<P>
|
||
|
the table is somewhat less." At the bottom of the page it says "this<P>
|
||
|
argument serves as a hint to the implementation of approximately how<P>
|
||
|
many entries you intend to store." So does the :SIZE intended to be the<P>
|
||
|
actual capacity of the table, or the amount of storage allocated to hold<P>
|
||
|
the table. For example, if the implementation of hash tables is<P>
|
||
|
designed for a loading of 65%, and the user specifies :SIZE 100, does<P>
|
||
|
the table returned have space allocated for 100 entries, so that it<P>
|
||
|
overflows and becomes bigger when 65 entries are inserted, or does the<P>
|
||
|
table have space allocated for 154 entries, so that it overflows and<P>
|
||
|
becomes bigger when 100 entries are inserted?<P>
|
||
|
<P>
|
||
|
<B>Proposal (HASH-TABLE-SIZE:INTENDED-ENTRIES):<P>
|
||
|
</B><P>
|
||
|
Believe the bottom of p.283 rather than the top. The :SIZE argument<P>
|
||
|
is approximately the number of entries that can be inserted without<P>
|
||
|
the table having to grow.<P>
|
||
|
<P>
|
||
|
Keep the first and last sentences of the definition of :REHASH-THRESHOLD<P>
|
||
|
(CLtL p. 284.) Replace the rest with:<P>
|
||
|
"This can be a <A REL=DEFINITION HREF="../Body/t_real.htm#real"><B>REAL</B></A> between 0 and 1, inclusive, which is a hint to the<P>
|
||
|
implementation of the maximum desired hash table occupancy level. An<P>
|
||
|
implementation is permitted to ignore this argument."<P>
|
||
|
<P>
|
||
|
<B>Editorial consequences:<P>
|
||
|
</B> Remove the second complete paragraph of CLtL p. 283. It's too implementa-<P>
|
||
|
tion-dependent. Clarify the implementation is not necessarily an actual<P>
|
||
|
hash table of any particular hashing technique.<P>
|
||
|
<P>
|
||
|
<B>Rationale:<P>
|
||
|
</B> <P>
|
||
|
The bottom of p.283 is user-oriented, the top is implementation-oriented.<P>
|
||
|
User-oriented seems more appropriate.<P>
|
||
|
<P>
|
||
|
<B>Current practice:<P>
|
||
|
</B> <P>
|
||
|
Symbolics Genera 7.4 adheres to <A HREF="iss190.htm">HASH-TABLE-SIZE:INTENDED-ENTRIES</A>.<P>
|
||
|
Other implementations were not surveyed.<P>
|
||
|
<P>
|
||
|
<B>Cost to Implementors:<P>
|
||
|
</B><P>
|
||
|
At worst adding a multiplication to <A REL=DEFINITION HREF="../Body/f_mk_has.htm#make-hash-table"><B>MAKE-HASH-TABLE</B></A>.<P>
|
||
|
<P>
|
||
|
<B>Cost to Users:<P>
|
||
|
</B><P>
|
||
|
Probably none, but it is hard to predict.<P>
|
||
|
<P>
|
||
|
<B>Cost of non-adoption:<P>
|
||
|
</B> <P>
|
||
|
Implementations will probably vary in which of the two interpretations<P>
|
||
|
they believe. The language <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> will not be self-consistent.<P>
|
||
|
<P>
|
||
|
<B>Performance impact:<P>
|
||
|
</B><P>
|
||
|
None of any significance.<P>
|
||
|
<P>
|
||
|
<B>Benefits/Esthetics:<P>
|
||
|
</B><P>
|
||
|
More self-consistent language.<P>
|
||
|
<P>
|
||
|
<B>Discussion:<P>
|
||
|
</B><P>
|
||
|
None.<P>
|
||
|
</PRE>
|
||
|
<HR>
|
||
|
|
||
|
<A REL=NAVIGATOR HREF="../Front/StartPts.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Starting Points]" SRC="../Graphics/StartPts.gif" ALIGN=Bottom></A><A REL=TOC HREF="../Front/Contents.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Contents]" SRC="../Graphics/Contents.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Master.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Index]" SRC="../Graphics/Index.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Symbol.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Symbols]" SRC="../Graphics/Symbols.gif" ALIGN=Bottom></A><A REL=GLOSSARY HREF="../Body/26_a.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Glossary]" SRC="../Graphics/Glossary.gif" ALIGN=Bottom></A><A HREF="../Front/X3J13Iss.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Issues]" SRC="../Graphics/Issues.gif" ALIGN=Bottom></A><BR>
|
||
|
|
||
|
<A REL=COPYRIGHT HREF="../Front/Help.htm#Legal"><I>Copyright 1996-2005, LispWorks Ltd. All rights reserved.</I></A><P>
|
||
|
</BODY>
|
||
|
</HTML>
|