mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
5d7b5481ca
* hash.c (rb_hash_shift): use st_shift if hash is not being iterated to delete element without iterating the whole hash. * hash.c (shift_i): remove function * include/ruby/st.h (st_shift): add st_shift function * st.c (st_shift): ditto [Bug #8312] [ruby-core:54524] Patch by funny-falcon git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
10 lines
92 B
Ruby
10 lines
92 B
Ruby
h = {}
|
|
|
|
10000.times do |i|
|
|
h[i] = nil
|
|
end
|
|
|
|
50000.times do
|
|
k, v = h.shift
|
|
h[k] = v
|
|
end
|