Re: [dev] The mysterious 31

2010-08-04 Thread John Yates
David, You are correct on many counts. Our divergent domains of development definitely colors our biases. I work with high end out of order processors. The Intel Core i7 has a multiply latency of 3 cycles and can issue a new multiply into the pipeline every cycle. It has a worst case integer d

Re: [dev] The mysterious 31

2010-08-04 Thread David Tweed
On Wed, Aug 4, 2010 at 6:01 PM, David Tweed wrote: > On Wed, Aug 4, 2010 at 2:22 PM, John Yates wrote: >> performance though. An instruction reference claims that it's latency > is 50 instructions on an Atom, which is why I try and avoid > unnecessary divisions.) Oops: Make that 50 cycles. --

Re: [dev] The mysterious 31

2010-08-04 Thread David Tweed
On Wed, Aug 4, 2010 at 2:22 PM, John Yates wrote: > Here are two useful references: > >  http://bretm.home.comcast.net/hash/ >  http://burtleburtle.net/bob/hash/ > > RE computation cost: Generalized integer multiplication and integer > division both used to be expensive.  On modern processors a >

Re: [dev] The mysterious 31

2010-08-04 Thread John Yates
Here are two useful references: http://bretm.home.comcast.net/hash/ http://burtleburtle.net/bob/hash/ RE computation cost: Generalized integer multiplication and integer division both used to be expensive. On modern processors a multiplication is fully pipelined and comparable to an L1 data

Re: [dev] The mysterious 31

2010-08-04 Thread Jacob Todd
On Wed, Aug 04, 2010 at 05:01:56AM +0100, David Tweed wrote: > It's also worth remembering that K & R was written at a time many > decades ago when performance aspects of computer architecture were a > lot, lot simpler. Apparently they have > > #define HASHSIZE 101 > > which given that there's no

Re: [dev] The mysterious 31

2010-08-04 Thread Robert Ransom
On Tue, 3 Aug 2010 23:08:49 -0400 Kris Maglione wrote: > On Tue, Aug 03, 2010 at 11:03:50PM -0400, Kris Maglione wrote: > >There isn't much science to hash functions, > > Let me rephrase that, given the nature of this list. There's not > much science to simple string hash functions. More corre

Re: [dev] curses samterm

2010-08-04 Thread markus schnalke
[2010-08-03 16:30] Joe > [08/03/10] @11:28AM PDT, mei...@marmaro.de wrote: > > [2010-08-03 10:14] Joe > > > NAME > > >ed - text editor > > > > > > SYNOPSIS > > >ed [-] [-sx] [-p string] [file] > > > > It should be: ed [-] [file] > > I concur. fwd: sj...@apple.com. > My only

Re: [dev] The mysterious 31

2010-08-04 Thread pancake
It's about entropy and maths. Not magic. This way you rotate over the most changing bits (lower) of each char of the string while reapplying the current calculation over the previous result. In r2 I use something similar in util/str.c In Java they use similar algorithm. I think the book 'i