public
Description: StrokeDB is an embeddable distributed document database written in Ruby
Homepage: http://strokedb.com/
Clone URL: git://github.com/yrashk/strokedb.git
renamed SimpleSkiplist to Skiplist
oleganza (author)
Sun Jun 08 14:05:26 -0700 2008
commit  9785ab9c6245d9c23e95a0a1f04bb8c300984323
tree    bdf4d03182ec4efeb86d64cb1a95ee887eee9256
parent  ff4c04e1f3e2f65f3984ce9d75166278c1391118
...
1
 
...
 
1
0
@@ -1 +1 @@
0
-require 'data_structures/simple_skiplist'
0
+require 'data_structures/skiplist'
...
58
59
60
61
 
62
63
64
...
58
59
60
 
61
62
63
64
0
@@ -58,7 +58,7 @@ module StrokeDB
0
     end
0
 
0
     def clear!
0
-      @container = SimpleSkiplist.new
0
+      @container = Skiplist.new
0
     end
0
 
0
     def close!
...
2
3
4
5
 
6
7
8
9
 
10
11
12
...
2
3
4
 
5
6
7
8
 
9
10
11
12
0
@@ -2,11 +2,11 @@ module StrokeDB
0
   class MemoryViewStorage < ViewStorage
0
     
0
     def initialize(options = {})
0
-      @list = SimpleSkiplist.new
0
+      @list = Skiplist.new
0
     end
0
     
0
     def clear!
0
-      @list = SimpleSkiplist.new
0
+      @list = Skiplist.new
0
     end
0
     
0
   end
...
85
86
87
88
 
89
90
91
 
92
93
94
...
85
86
87
 
88
89
90
 
91
92
93
94
0
@@ -85,10 +85,10 @@ module StrokeDB
0
       end
0
       
0
       if File.exists?(@list_path)
0
-        @list = SimpleSkiplist.load(File.read(@list_path))
0
+        @list = Skiplist.load(File.read(@list_path))
0
       else
0
         info "List file (#{@list_path}) was not found, creating a brand new skiplist."
0
-        @list = SimpleSkiplist.new(@params)
0
+        @list = Skiplist.new(@params)
0
       end
0
       
0
       if File.exists?(@log_path)
...
7
8
9
10
 
11
12
13
...
7
8
9
 
10
11
12
13
0
@@ -7,7 +7,7 @@ include Benchmark
0
 
0
 @path = File.dirname(__FILE__) + "/../../spec/temp/storages/archive_volume"
0
 
0
-SimpleSkiplist.optimize!(:C)
0
+Skiplist.optimize!(:C)
0
 
0
   [2000].each do |n|
0
 
...
23
24
25
26
 
27
28
29
...
23
24
25
 
26
27
28
29
0
@@ -23,7 +23,7 @@ N = 1_000
0
 #   
0
 # end
0
 
0
-SimpleSkiplist.optimize!(:C)
0
+Skiplist.optimize!(:C)
0
 
0
 # FileUtils.rm_rf "../../spec/temp/storages/bigstore"
0
 # StrokeDB::Config.build :default => true, :base_path => "../../spec/temp/storages/bigstore"
...
7
8
9
10
 
11
12
13
14
15
16
 
17
18
19
...
21
22
23
24
25
26
27
28
29
 
 
 
 
 
 
30
31
32
33
34
 
35
36
37
...
39
40
41
42
43
44
45
46
47
 
 
 
 
 
 
48
49
50
...
53
54
55
56
 
57
58
 
59
60
61
...
66
67
68
69
 
70
71
72
...
7
8
9
 
10
11
12
13
14
15
 
16
17
18
19
...
21
22
23
 
 
 
 
 
 
24
25
26
27
28
29
30
31
32
33
 
34
35
36
37
...
39
40
41
 
 
 
 
 
 
42
43
44
45
46
47
48
49
50
...
53
54
55
 
56
57
 
58
59
60
61
...
66
67
68
 
69
70
71
72
0
@@ -7,13 +7,13 @@ puts "Serialization techniques"
0
 
0
 len = 2_000
0
 array = (1..len).map{ [rand(len).to_s]*2 }
0
-biglist = SimpleSkiplist.from_a(array)
0
+biglist = Skiplist.from_a(array)
0
 dumped = biglist.marshal_dump
0
 
0
 Benchmark.bm(17) do |x|
0
   # First technique: to_a/from_a
0
   GC.start
0
-  x.report("SimpleSkiplist#to_a          ") do
0
+  x.report("Skiplist#to_a          ") do
0
     biglist.to_a
0
     biglist.to_a
0
     biglist.to_a
0
@@ -21,17 +21,17 @@ Benchmark.bm(17) do |x|
0
     biglist.to_a
0
   end
0
   GC.start
0
-  x.report("SimpleSkiplist.from_a        ") do
0
-    SimpleSkiplist.from_a(array)
0
-    SimpleSkiplist.from_a(array)
0
-    SimpleSkiplist.from_a(array)
0
-    SimpleSkiplist.from_a(array)
0
-    SimpleSkiplist.from_a(array)
0
+  x.report("Skiplist.from_a        ") do
0
+    Skiplist.from_a(array)
0
+    Skiplist.from_a(array)
0
+    Skiplist.from_a(array)
0
+    Skiplist.from_a(array)
0
+    Skiplist.from_a(array)
0
   end
0
 
0
   # Another technique: Marshal.dump
0
   GC.start
0
-  x.report("SimpleSkiplist#marshal_dump  ") do
0
+  x.report("Skiplist#marshal_dump  ") do
0
     biglist.marshal_dump
0
     biglist.marshal_dump
0
     biglist.marshal_dump
0
@@ -39,12 +39,12 @@ Benchmark.bm(17) do |x|
0
     biglist.marshal_dump
0
   end
0
   GC.start
0
-  x.report("SimpleSkiplist#marshal_load  ") do
0
-    SimpleSkiplist.allocate.marshal_load(dumped.dup)
0
-    SimpleSkiplist.allocate.marshal_load(dumped.dup)
0
-    SimpleSkiplist.allocate.marshal_load(dumped.dup)
0
-    SimpleSkiplist.allocate.marshal_load(dumped.dup)
0
-    SimpleSkiplist.allocate.marshal_load(dumped.dup)
0
+  x.report("Skiplist#marshal_load  ") do
0
+    Skiplist.allocate.marshal_load(dumped.dup)
0
+    Skiplist.allocate.marshal_load(dumped.dup)
0
+    Skiplist.allocate.marshal_load(dumped.dup)
0
+    Skiplist.allocate.marshal_load(dumped.dup)
0
+    Skiplist.allocate.marshal_load(dumped.dup)
0
   end
0
 end
0
 
0
@@ -53,9 +53,9 @@ puts "Find/insert techniques"
0
 Benchmark.bm(42) do |x|
0
   langs = [:C]    if RUBY_PLATFORM !~ /java/
0
   langs = [:Java] if RUBY_PLATFORM =~ /java/
0
-  SimpleSkiplist.with_optimizations(langs) do |lang|
0
+  Skiplist.with_optimizations(langs) do |lang|
0
     GC.start
0
-    x.report("SimpleSkiplist#find 5000 #{lang}".ljust(32)) do 
0
+    x.report("Skiplist#find 5000 #{lang}".ljust(32)) do 
0
       1000.times do
0
         key = rand(len).to_s
0
         biglist.find(key)
0
@@ -66,7 +66,7 @@ Benchmark.bm(42) do |x|
0
       end
0
     end
0
     GC.start
0
-    x.report("SimpleSkiplist#insert 5000 #{lang}".ljust(32)) do 
0
+    x.report("Skiplist#insert 5000 #{lang}".ljust(32)) do 
0
       1000.times do
0
         key = rand(len).to_s
0
         biglist.insert(key, key)
...
38
39
40
41
 
42
43
44
...
38
39
40
 
41
42
43
44
0
@@ -38,7 +38,7 @@ end
0
 
0
 benchmark!("Ruby")
0
 
0
-SimpleSkiplist.optimize!(:C)
0
+Skiplist.optimize!(:C)
0
 
0
 benchmark!("C")
0
 
...
14
15
16
17
 
18
19
20
...
14
15
16
 
17
18
19
20
0
@@ -14,7 +14,7 @@ describe "SkiplistVolume inserts and finds", :shared => true do
0
   end
0
 end
0
 
0
-#SimpleSkiplist.with_optimizations(OPTIMIZATIONS) do |lang|
0
+#Skiplist.with_optimizations(OPTIMIZATIONS) do |lang|
0
 lang = "Ruby {FIXME: with_optimizations is irreversible operation for now}"
0
   describe "Brand new SkiplistVolume [#{lang}]" do
0
     before(:each) do

Comments