mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
df6722d9fc
commit
71b70f3cdf
7 changed files with 106 additions and 106 deletions
|
@ -1,10 +1,10 @@
|
||||||
i = 0
|
i = 0
|
||||||
while i<30_000_000 # while loop 1
|
while i<30_000_000 # while loop 1
|
||||||
a = '' # short-lived String
|
a = '' # short-lived String
|
||||||
b = ''
|
b = ''
|
||||||
c = ''
|
c = ''
|
||||||
d = ''
|
d = ''
|
||||||
e = ''
|
e = ''
|
||||||
f = ''
|
f = ''
|
||||||
i+=1
|
i+=1
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
def nested_hash h, n
|
def nested_hash h, n
|
||||||
if n == 0
|
if n == 0
|
||||||
''
|
''
|
||||||
else
|
else
|
||||||
10.times{
|
10.times{
|
||||||
h[Object.new] = nested_hash(h, n-1)
|
h[Object.new] = nested_hash(h, n-1)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
long_lived = Hash.new
|
long_lived = Hash.new
|
||||||
nested_hash long_lived, 6
|
nested_hash long_lived, 6
|
||||||
|
|
||||||
GC.start
|
GC.start
|
||||||
GC.start
|
GC.start
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while i<30_000_000 # while loop 1
|
while i<30_000_000 # while loop 1
|
||||||
a = '' # short-lived String
|
a = '' # short-lived String
|
||||||
b = ''
|
b = ''
|
||||||
c = ''
|
c = ''
|
||||||
d = ''
|
d = ''
|
||||||
e = ''
|
e = ''
|
||||||
f = ''
|
f = ''
|
||||||
i+=1
|
i+=1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
long_lived = Array.new(1_000_000){|i| "#{i}"}
|
long_lived = Array.new(1_000_000){|i| "#{i}"}
|
||||||
GC.start
|
GC.start
|
||||||
GC.start
|
GC.start
|
||||||
i = 0
|
i = 0
|
||||||
while i<30_000_000 # while loop 1
|
while i<30_000_000 # while loop 1
|
||||||
a = '' # short-lived String
|
a = '' # short-lived String
|
||||||
b = ''
|
b = ''
|
||||||
c = ''
|
c = ''
|
||||||
d = ''
|
d = ''
|
||||||
e = ''
|
e = ''
|
||||||
f = ''
|
f = ''
|
||||||
i+=1
|
i+=1
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
# make many symbols
|
# make many symbols
|
||||||
50_000.times{|i| sym = "sym#{i}".to_sym}
|
50_000.times{|i| sym = "sym#{i}".to_sym}
|
||||||
GC.start
|
GC.start
|
||||||
GC.start
|
GC.start
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while i<30_000_000 # while loop 1
|
while i<30_000_000 # while loop 1
|
||||||
a = '' # short-lived String
|
a = '' # short-lived String
|
||||||
b = ''
|
b = ''
|
||||||
c = ''
|
c = ''
|
||||||
d = ''
|
d = ''
|
||||||
e = ''
|
e = ''
|
||||||
f = ''
|
f = ''
|
||||||
i+=1
|
i+=1
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
long_lived = []
|
long_lived = []
|
||||||
GC.start
|
GC.start
|
||||||
GC.start
|
GC.start
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
short_lived = ''
|
short_lived = ''
|
||||||
while i<30_000_000 # while loop 1
|
while i<30_000_000 # while loop 1
|
||||||
long_lived[0] = short_lived # write barrier
|
long_lived[0] = short_lived # write barrier
|
||||||
i+=1
|
i+=1
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
class C
|
class C
|
||||||
attr_accessor :foo
|
attr_accessor :foo
|
||||||
end
|
end
|
||||||
long_lived = C.new
|
long_lived = C.new
|
||||||
GC.start
|
GC.start
|
||||||
GC.start
|
GC.start
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
short_lived = ''
|
short_lived = ''
|
||||||
while i<30_000_000 # while loop 1
|
while i<30_000_000 # while loop 1
|
||||||
long_lived.foo = short_lived # write barrier
|
long_lived.foo = short_lived # write barrier
|
||||||
i+=1
|
i+=1
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
require 'thread'
|
require 'thread'
|
||||||
|
|
||||||
n = 1_000_000
|
n = 1_000_000
|
||||||
q = Queue.new
|
q = Queue.new
|
||||||
consumer = Thread.new{
|
consumer = Thread.new{
|
||||||
while q.pop
|
while q.pop
|
||||||
# consuming
|
# consuming
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
producer = Thread.new{
|
producer = Thread.new{
|
||||||
n.times{
|
n.times{
|
||||||
q.push true
|
q.push true
|
||||||
}
|
}
|
||||||
q.push nil
|
q.push nil
|
||||||
}
|
}
|
||||||
|
|
||||||
consumer.join
|
consumer.join
|
||||||
|
|
Loading…
Reference in a new issue