From: MenTaLguY Date: 2007-11-22T06:14:58+09:00 Subject: Re: Ordered Hash Usefulness On Thu, 22 Nov 2007 05:25:07 +0900, Robert Klemme wrote: >> In Ruby 1.8 the enumeration order of a Hash is undefined, in Ruby 1.9, >> unless it's been backed out recently, it's defined as above. > > Does Ruby 1.9 really impose the overhead to maintain insertion order for > *every* Hash? I asked matz about that on ruby-core. The overhead turns out to be very small; 1.9 maintains a doubly-linked list of hash elements, which has constant-time insertion and removal. Memory overhead is two words per hash element. We may implement the 1.9 ordering in JRuby soon, as it solves a number of problems with concurrency and iterator stability. -mental