On 25.02.2011 17:57, Nick Brown wrote:
> Are the lookup, insertion, deletion, and sort costs of Hash objects
> documented anywhere? I would be interested in average-case
> and worst-case times... are they linear, logarithmic, exponential, etc.
> in time?

Are you familiar with hashing in general?  If not, please have a look here:
http://en.wikipedia.org/wiki/Hash_table#Performance_analysis
http://en.wikipedia.org/wiki/Hash_function

If you want true numbers you need to benchmark because all theory may 
fail you for particular data or access patterns.

> Also, is there a way to 'tune' hashes so that they use underlying
> algorithms which are faster at, say, look-ups over inserts or
> vice-versa? That would be killer.

You can't modify internal workings of the built in Hash class unless you 
start patching the C code.  But of course you can create your own 
implementation for custom cases.

Cheers

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/