From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.224.165.82 with SMTP id h18mr13868256qay.3.1377930121542; Fri, 30 Aug 2013 23:22:01 -0700 (PDT) X-Received: by 10.49.99.65 with SMTP id eo1mr501221qeb.3.1377930121529; Fri, 30 Aug 2013 23:22:01 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.ripco.com!news.glorb.com!q10no2254648qai.0!news-out.google.com!p7ni0qas.0!nntp.google.com!fx3no6280902qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 30 Aug 2013 23:22:01 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=105.236.92.204; posting-account=p-xPhAkAAADjHQWEO7sFME2XBdF1P_2H NNTP-Posting-Host: 105.236.92.204 References: <1679ec49-424b-43bd-8f35-a5f69e658112@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <7aa26916-cde1-46f8-9f49-d9ebcc2dee93@googlegroups.com> Subject: Re: Hash Type Size From: Peter Brooks Injection-Date: Sat, 31 Aug 2013 06:22:01 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:17062 Date: 2013-08-30T23:22:01-07:00 List-Id: On Tuesday, 20 August 2013 00:12:13 UTC+2, Randy Brukardt wrote: >=20 > Like Integer, the advice is that it should be at least a particular size,= =20 > and nothing more is said. I'm pretty sure there is no intent at all (so f= ar=20 > as I recall, we never discussed anything about that). The reason for the= =20 > 32-bit advice is to ensure that there are plenty of values available (16-= bit=20 > wouldn't be enough). >=20 I'd be quite happy to make it explicit. It'd be good to have a Ada.Containe= rs.Hash_Type64 to make it clear that that is what is being used. Even though there is no way that you'd ever have that number of items in a = container, that isn't the point. The larger the size of the hash, the small= er the chance of collisions and, if the native machine size is 64 bits (or,= in future, maybe 128 bits), then machine operations will be no slower in 6= 4 than in 32 or 16 bits, so the reduction in collisions will make the appli= cation run much faster for large amounts of data. You might say that this affects portability, which is, on the face of it, t= rue. However, if you're using a 64 bit hash, then you're working with big d= ata, so you'll not be using machines with a size less than 64 bits, making = portability to smaller word sizes irrelevant. I agree completely that it should be explicit, though! It'd be good if the = Ada manual said recommended that the bit size was 'at least' 32 bits and th= at it matched the natural word size 'where possible'. So, on a 16 bit machi= ne hashing would have a performance penalty - so, for that case, it'd be us= eful to have an Ada.Containers.Hash_Type16 because that would probably be g= ood enough for a real time application that used hashing, and would be twic= e as fast.