This is really cool! I'm getting a good performance increase: Pure Ruby Version real 16m58.017s user 16m28.190s sys 0m10.100s C optimized version real 12m54.439s user 12m27.980s sys 0m8.550s Very slick. Thanks to everyone who's contributed suggestions and code. Ruby really does have one of the best communities I've seen, and that's one major reason it's my language of choice. Cheers, Travis In article <20030222003658.ED0E.MOONWOLF / moonwolf.com>, MoonWolf wrote: > --------_3E56479AED4F017A0008_MULTIPART_MIXED_ > Content-Type: text/plain; charset="US-ASCII" > Content-Transfer-Encoding: 7bit > >> Nice. Perhaps could be made more general by checking if the value is a >> Fixnum first? (And if not, it could do h[x] = h[x].succ) > > generic version 'hashsuccg.c' here. > > $ ruby -r mkmf -e'create_makefile("hashsuccg")' > $ make > # make install > > Usage: > require "hashsuccg" > h = Hash.new("a") > h.succ! "foo" # => {"foo"=>"b"} > h.succ! "foo" # => {"foo"=>"c"} > > Benchmark: > $ time ruby b_hashsucc.rb # original hashsucc.c > ruby b_hashsucc.rb 5.04s user 0.01s system 100% cpu 5.048 total > $ time ruby b_hashsuccg.b # generic version > ruby b_hashsuccg.rb 6.23s user 0.01s system 100% cpu 6.236 total > > 'hashsucc.c' bug-fix version attached. > -- - Travis Whitton <whitton / atlantic.net>