1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rinda/tuplespace.rb (Rinda::TupleBag#delete): use rindex and

delete_at instead of delete for little improvement.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
seki 2007-05-27 18:03:08 +00:00
parent c80c57d940
commit 68db15e754
2 changed files with 12 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Mon May 28 02:54:05 2007 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* lib/rinda/tuplespace.rb (Rinda::TupleBag#delete): use rindex and
delete_at instead of delete for little improvement.
Sat May 26 00:05:22 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* test/ruby/test_beginendblock.rb (test_should_propagate_signaled):

View file

@ -316,8 +316,13 @@ module Rinda
# Removes +tuple+ from the TupleBag.
def delete(tuple)
size = tuple.size
@hash.fetch(size, []).delete(tuple)
key = tuple.size
ary = @hash[key]
return unless ary
pos = ary.rindex(tuple)
return unless pos
ary.delete_at(pos)
@hash.delete(key) if ary.empty?
end
##