On Mar 22, 2012, at 11:18 AM, H. S. Teoh wrote:
> On Wed, Mar 21, 2012 at 04:35:11PM +1100, Daniel Murphy wrote:
>> "H. S. Teoh" wrote in message
>> news:mailman.951.1332306541.4860.digitalmar...@puremagic.com...
>>>
>>> Here's the current hashing code for char[] and string:
>>>
>>> fore
On 3/22/12 1:18 PM, H. S. Teoh wrote:
Alright, so after some benchmarking, I found that the above custom hash
function works best for *short* (3 to 10 character) randomized
alphabetic strings (I assumed alphabetic to be the typical use case of
strings). It's faster than SuperFastHash, and even ha
On Mar 20, 2012, at 10:10 PM, H. S. Teoh wrote:
> On Wed, Mar 21, 2012 at 03:55:49PM +1100, Daniel Murphy wrote:
>> "H. S. Teoh" wrote in message
>> news:mailman.917.1332250604.4860.digitalmar...@puremagic.com...
> [...]
>>> Then the question is, what should be the fix?
>>>
>>> Currently, char[
On Wed, Mar 21, 2012 at 04:35:11PM +1100, Daniel Murphy wrote:
> "H. S. Teoh" wrote in message
> news:mailman.951.1332306541.4860.digitalmar...@puremagic.com...
> >
> > Here's the current hashing code for char[] and string:
> >
> >foreach (char c; s)
> >hash = hash * 11 + c;
>
"H. S. Teoh" wrote in message
news:mailman.951.1332306541.4860.digitalmar...@puremagic.com...
>
> Here's the current hashing code for char[] and string:
>
>foreach (char c; s)
>hash = hash * 11 + c;
>
> For const(char)[], it's rt.util.hash.hashOf, which is Paul Hsieh's
> Super
On Wed, Mar 21, 2012 at 03:55:49PM +1100, Daniel Murphy wrote:
> "H. S. Teoh" wrote in message
> news:mailman.917.1332250604.4860.digitalmar...@puremagic.com...
[...]
> > Then the question is, what should be the fix?
> >
> > Currently, char[] and string have getHash defined in
> > rt.typeinfo.ti_
"H. S. Teoh" wrote in message
news:mailman.917.1332250604.4860.digitalmar...@puremagic.com...
> On Tue, Mar 20, 2012 at 05:07:12PM +1100, Daniel Murphy wrote:
>> "H. S. Teoh" wrote in message
>> news:mailman.910.1332214803.4860.digitalmar...@puremagic.com...
>> > Is this a bug?
>> >
>> > char[]
On Tue, Mar 20, 2012 at 05:07:12PM +1100, Daniel Murphy wrote:
> "H. S. Teoh" wrote in message
> news:mailman.910.1332214803.4860.digitalmar...@puremagic.com...
> > Is this a bug?
> >
> > char[] a = "abc".dup;
> > const(char)[] b = "abc";
> > string c = "abc";
> >
> > writeln(typeid(a).getHash(&a
"H. S. Teoh" wrote in message
news:mailman.910.1332214803.4860.digitalmar...@puremagic.com...
> Is this a bug?
>
> char[] a = "abc".dup;
> const(char)[] b = "abc";
> string c = "abc";
>
> writeln(typeid(a).getHash(&a)); // 12914
> writeln(typeid(b).getHash(&b)); // 8503969683799911018
> writeln(t
Is this a bug?
char[] a = "abc".dup;
const(char)[] b = "abc";
string c = "abc";
writeln(typeid(a).getHash(&a)); // 12914
writeln(typeid(b).getHash(&b)); // 8503969683799911018
writeln(typeid(c).getHash(&c)); // 12914
T
--
Obviously, some things
10 matches
Mail list logo