memcached 0.6 → 0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,56 +0,0 @@
1
-
2
- HERE = File.dirname(__FILE__)
3
- $LOAD_PATH << "#{HERE}/../../lib/"
4
-
5
- require 'memcached'
6
- require 'benchmark'
7
-
8
- @value = []
9
- @marshalled = Marshal.dump(@value)
10
-
11
- @opts = [
12
- ['127.0.0.1:43042', '127.0.0.1:43043'],
13
- {
14
- :buffer_requests => true,
15
- :no_block => true,
16
- :namespace => "benchmark_namespace"
17
- }
18
- ]
19
- @key1 = "Short"
20
- @key2 = "Sym1-2-3::45"*8
21
- @key3 = "Long"*40
22
- @key4 = "Medium"*8
23
-
24
- def restart_servers
25
- system("ruby #{HERE}/../setup.rb")
26
- sleep(1)
27
- end
28
-
29
- Benchmark.bm(31) do |x|
30
- n = 3000
31
- restart_servers
32
-
33
- @m = Memcached.new(*@opts)
34
- x.report("set:ruby:memcached") do
35
- n.times do
36
- @m.set @key1, @value
37
- @m.set @key2, @value
38
- @m.set @key3, @value
39
- @m.set @key1, @value
40
- @m.set @key2, @value
41
- @m.set @key3, @value
42
- end
43
- end
44
-
45
- @m = Memcached.new(*@opts)
46
- x.report("get:ruby:memcached") do
47
- n.times do
48
- @m.get @key1
49
- @m.get @key2
50
- @m.get @key3
51
- @m.get @key1
52
- @m.get @key2
53
- @m.get @key3
54
- end
55
- end
56
- end
@@ -1,49 +0,0 @@
1
-
2
- HERE = File.dirname(__FILE__)
3
- $LOAD_PATH << "#{HERE}/../../lib/"
4
-
5
- require 'memcached'
6
- require 'ostruct'
7
- require 'benchmark'
8
- require 'rubygems'
9
- require 'ruby-prof'
10
-
11
- @value = []
12
- @marshalled = Marshal.dump(@value)
13
- @opts = [
14
- ['127.0.0.1:43042', '127.0.0.1:43043'],
15
- {
16
- :buffer_requests => true,
17
- :no_block => true,
18
- :namespace => "benchmark_namespace"
19
- }
20
- ]
21
- @key1 = "Short"
22
- @key2 = "Sym1-2-3::45"*8
23
- @key3 = "Long"*40
24
- @key4 = "Medium"*8
25
-
26
- system("ruby #{HERE}/../setup.rb")
27
- sleep(1)
28
-
29
- @m = Memcached.new(*@opts)
30
-
31
- result = RubyProf.profile do
32
- 1000.times do
33
- @m.set @key1, @value
34
- @m.set @key2, @value
35
- @m.set @key3, @value
36
- @m.get @key1
37
- @m.get @key2
38
- @m.get @key3
39
- @m.set @key1, @value
40
- @m.get @key1
41
- @m.set @key2, @value
42
- @m.get @key2
43
- @m.set @key3, @value
44
- @m.get @key3
45
- end
46
- end
47
-
48
- printer = RubyProf::GraphPrinter.new(result)
49
- printer.print(STDOUT, 0)