groonga 0.9.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. metadata +38 -227
  2. data/AUTHORS +0 -5
  3. data/NEWS.ja.rdoc +0 -114
  4. data/NEWS.rdoc +0 -116
  5. data/README.ja.rdoc +0 -63
  6. data/README.rdoc +0 -64
  7. data/Rakefile +0 -216
  8. data/benchmark/common.rb +0 -49
  9. data/benchmark/read-write-many-small-items.rb +0 -144
  10. data/benchmark/write-many-small-items.rb +0 -135
  11. data/example/bookmark.rb +0 -161
  12. data/example/index-html.rb +0 -89
  13. data/example/search/config.ru +0 -211
  14. data/example/search/public/css/groonga.css +0 -122
  15. data/ext/.gitignore +0 -2
  16. data/ext/rb-grn-accessor.c +0 -52
  17. data/ext/rb-grn-array-cursor.c +0 -36
  18. data/ext/rb-grn-array.c +0 -210
  19. data/ext/rb-grn-column.c +0 -570
  20. data/ext/rb-grn-context.c +0 -655
  21. data/ext/rb-grn-database.c +0 -415
  22. data/ext/rb-grn-encoding-support.c +0 -64
  23. data/ext/rb-grn-encoding.c +0 -257
  24. data/ext/rb-grn-exception.c +0 -1110
  25. data/ext/rb-grn-expression-builder.c +0 -75
  26. data/ext/rb-grn-expression.c +0 -732
  27. data/ext/rb-grn-fix-size-column.c +0 -166
  28. data/ext/rb-grn-hash-cursor.c +0 -38
  29. data/ext/rb-grn-hash.c +0 -294
  30. data/ext/rb-grn-index-column.c +0 -488
  31. data/ext/rb-grn-logger.c +0 -325
  32. data/ext/rb-grn-object.c +0 -1335
  33. data/ext/rb-grn-operation.c +0 -198
  34. data/ext/rb-grn-patricia-trie-cursor.c +0 -39
  35. data/ext/rb-grn-patricia-trie.c +0 -488
  36. data/ext/rb-grn-procedure.c +0 -52
  37. data/ext/rb-grn-query.c +0 -260
  38. data/ext/rb-grn-record.c +0 -40
  39. data/ext/rb-grn-snippet.c +0 -328
  40. data/ext/rb-grn-table-cursor-key-support.c +0 -69
  41. data/ext/rb-grn-table-cursor.c +0 -246
  42. data/ext/rb-grn-table-key-support.c +0 -731
  43. data/ext/rb-grn-table.c +0 -2038
  44. data/ext/rb-grn-type.c +0 -181
  45. data/ext/rb-grn-utils.c +0 -769
  46. data/ext/rb-grn-variable-size-column.c +0 -36
  47. data/ext/rb-grn-variable.c +0 -108
  48. data/ext/rb-grn.h +0 -684
  49. data/ext/rb-groonga.c +0 -113
  50. data/extconf.rb +0 -216
  51. data/html/bar.svg +0 -153
  52. data/html/developer.html +0 -121
  53. data/html/developer.svg +0 -469
  54. data/html/download.svg +0 -253
  55. data/html/favicon.ico +0 -0
  56. data/html/favicon.xcf +0 -0
  57. data/html/footer.html.erb +0 -28
  58. data/html/head.html.erb +0 -4
  59. data/html/header.html.erb +0 -17
  60. data/html/index.html +0 -147
  61. data/html/install.svg +0 -636
  62. data/html/logo.xcf +0 -0
  63. data/html/ranguba.css +0 -248
  64. data/html/tutorial.svg +0 -559
  65. data/lib/groonga.rb +0 -83
  66. data/lib/groonga/expression-builder.rb +0 -285
  67. data/lib/groonga/patricia-trie.rb +0 -53
  68. data/lib/groonga/record.rb +0 -276
  69. data/lib/groonga/schema.rb +0 -916
  70. data/license/GPL +0 -340
  71. data/license/LGPL +0 -504
  72. data/license/RUBY +0 -59
  73. data/misc/grnop2ruby.rb +0 -49
  74. data/pkg-config.rb +0 -333
  75. data/src/rb-grn-table-cursor.c +0 -296
  76. data/test-unit/Rakefile +0 -40
  77. data/test-unit/TODO +0 -5
  78. data/test-unit/bin/testrb +0 -5
  79. data/test-unit/html/classic.html +0 -15
  80. data/test-unit/html/index.html +0 -25
  81. data/test-unit/html/index.html.ja +0 -27
  82. data/test-unit/lib/test/unit.rb +0 -323
  83. data/test-unit/lib/test/unit/assertionfailederror.rb +0 -25
  84. data/test-unit/lib/test/unit/assertions.rb +0 -1230
  85. data/test-unit/lib/test/unit/attribute.rb +0 -125
  86. data/test-unit/lib/test/unit/autorunner.rb +0 -353
  87. data/test-unit/lib/test/unit/collector.rb +0 -36
  88. data/test-unit/lib/test/unit/collector/descendant.rb +0 -23
  89. data/test-unit/lib/test/unit/collector/dir.rb +0 -108
  90. data/test-unit/lib/test/unit/collector/load.rb +0 -136
  91. data/test-unit/lib/test/unit/collector/objectspace.rb +0 -34
  92. data/test-unit/lib/test/unit/color-scheme.rb +0 -102
  93. data/test-unit/lib/test/unit/color.rb +0 -96
  94. data/test-unit/lib/test/unit/diff.rb +0 -724
  95. data/test-unit/lib/test/unit/error.rb +0 -130
  96. data/test-unit/lib/test/unit/exceptionhandler.rb +0 -39
  97. data/test-unit/lib/test/unit/failure.rb +0 -136
  98. data/test-unit/lib/test/unit/fixture.rb +0 -176
  99. data/test-unit/lib/test/unit/notification.rb +0 -129
  100. data/test-unit/lib/test/unit/omission.rb +0 -191
  101. data/test-unit/lib/test/unit/pending.rb +0 -150
  102. data/test-unit/lib/test/unit/priority.rb +0 -181
  103. data/test-unit/lib/test/unit/runner/console.rb +0 -52
  104. data/test-unit/lib/test/unit/runner/emacs.rb +0 -8
  105. data/test-unit/lib/test/unit/runner/tap.rb +0 -8
  106. data/test-unit/lib/test/unit/testcase.rb +0 -476
  107. data/test-unit/lib/test/unit/testresult.rb +0 -89
  108. data/test-unit/lib/test/unit/testsuite.rb +0 -110
  109. data/test-unit/lib/test/unit/ui/console/outputlevel.rb +0 -14
  110. data/test-unit/lib/test/unit/ui/console/testrunner.rb +0 -464
  111. data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +0 -63
  112. data/test-unit/lib/test/unit/ui/tap/testrunner.rb +0 -92
  113. data/test-unit/lib/test/unit/ui/testrunner.rb +0 -28
  114. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +0 -77
  115. data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +0 -41
  116. data/test-unit/lib/test/unit/util/backtracefilter.rb +0 -41
  117. data/test-unit/lib/test/unit/util/method-owner-finder.rb +0 -28
  118. data/test-unit/lib/test/unit/util/observable.rb +0 -90
  119. data/test-unit/lib/test/unit/util/procwrapper.rb +0 -48
  120. data/test-unit/lib/test/unit/version.rb +0 -7
  121. data/test-unit/sample/adder.rb +0 -13
  122. data/test-unit/sample/subtracter.rb +0 -12
  123. data/test-unit/sample/test_adder.rb +0 -20
  124. data/test-unit/sample/test_subtracter.rb +0 -20
  125. data/test-unit/sample/test_user.rb +0 -23
  126. data/test-unit/test/collector/test-descendant.rb +0 -133
  127. data/test-unit/test/collector/test-load.rb +0 -329
  128. data/test-unit/test/collector/test_dir.rb +0 -406
  129. data/test-unit/test/collector/test_objectspace.rb +0 -100
  130. data/test-unit/test/run-test.rb +0 -15
  131. data/test-unit/test/test-attribute.rb +0 -86
  132. data/test-unit/test/test-color-scheme.rb +0 -67
  133. data/test-unit/test/test-color.rb +0 -47
  134. data/test-unit/test/test-diff.rb +0 -518
  135. data/test-unit/test/test-emacs-runner.rb +0 -60
  136. data/test-unit/test/test-fixture.rb +0 -287
  137. data/test-unit/test/test-notification.rb +0 -33
  138. data/test-unit/test/test-omission.rb +0 -81
  139. data/test-unit/test/test-pending.rb +0 -70
  140. data/test-unit/test/test-priority.rb +0 -119
  141. data/test-unit/test/test-testcase.rb +0 -554
  142. data/test-unit/test/test_assertions.rb +0 -1151
  143. data/test-unit/test/test_error.rb +0 -26
  144. data/test-unit/test/test_failure.rb +0 -33
  145. data/test-unit/test/test_testresult.rb +0 -113
  146. data/test-unit/test/test_testsuite.rb +0 -129
  147. data/test-unit/test/testunit-test-util.rb +0 -14
  148. data/test-unit/test/ui/test_testrunmediator.rb +0 -20
  149. data/test-unit/test/util/test-method-owner-finder.rb +0 -38
  150. data/test-unit/test/util/test_backtracefilter.rb +0 -41
  151. data/test-unit/test/util/test_observable.rb +0 -102
  152. data/test-unit/test/util/test_procwrapper.rb +0 -36
  153. data/test/.gitignore +0 -1
  154. data/test/groonga-test-utils.rb +0 -106
  155. data/test/run-test.rb +0 -58
  156. data/test/test-array.rb +0 -97
  157. data/test/test-column.rb +0 -298
  158. data/test/test-context.rb +0 -73
  159. data/test/test-database.rb +0 -113
  160. data/test/test-encoding.rb +0 -33
  161. data/test/test-exception.rb +0 -93
  162. data/test/test-expression-builder.rb +0 -156
  163. data/test/test-expression.rb +0 -133
  164. data/test/test-fix-size-column.rb +0 -65
  165. data/test/test-gqtp.rb +0 -70
  166. data/test/test-hash.rb +0 -312
  167. data/test/test-index-column.rb +0 -81
  168. data/test/test-patricia-trie.rb +0 -189
  169. data/test/test-procedure.rb +0 -37
  170. data/test/test-query.rb +0 -22
  171. data/test/test-record.rb +0 -268
  172. data/test/test-remote.rb +0 -53
  173. data/test/test-schema.rb +0 -416
  174. data/test/test-snippet.rb +0 -121
  175. data/test/test-table-cursor.rb +0 -153
  176. data/test/test-table-offset-and-limit.rb +0 -102
  177. data/test/test-table-select-normalize.rb +0 -48
  178. data/test/test-table-select.rb +0 -145
  179. data/test/test-table.rb +0 -642
  180. data/test/test-type.rb +0 -61
  181. data/test/test-variable-size-column.rb +0 -98
  182. data/test/test-variable.rb +0 -28
  183. data/test/test-vector-column.rb +0 -76
  184. data/test/test-version.rb +0 -31
  185. data/text/TUTORIAL.ja.rdoc +0 -392
  186. data/text/expression.rdoc +0 -284
data/README.ja.rdoc DELETED
@@ -1,63 +0,0 @@
1
- = はじめに
2
-
3
- == 名前
4
-
5
- Ruby/groonga
6
-
7
- == 説明
8
-
9
- 全文検索機能とカラムストア機能を提供するgroongaのRubyバイン
10
- ディングです。
11
-
12
- groongaのいわゆるDB-API層をRubyから使うための拡張ライブラリで
13
- す。groongaのAPIをそのままRubyレベルに提供するのではなく、
14
- Rubyらしく読み書きしやすいAPIとして提供します。高速・高機能な
15
- groongaをRubyらしい書き方で利用できます。
16
-
17
- groongaに関する情報は以下を参照して下さい。
18
-
19
- * groonga: http://groonga.org/
20
-
21
- == 作者
22
-
23
- Kouhei Sutou:: <tt><kou@clear-code.com></tt>
24
- Tasuku SUENAGA:: <tt><a@razil.jp></tt>
25
- daijiro:: <tt><morita@razil.jp></tt>
26
- Yuto HAYAMIZU:: <tt><y.hayamizu@gmail.com></tt>
27
- SHIDARA Yoji:: <tt><dara@shidara.net></tt>
28
-
29
- == ライセンス
30
-
31
- LGPL 2.1です。詳しくはlicense/LGPLを見てください。
32
-
33
- pkg-config.rbはrcairoに付属しているもので、これはRubyライセ
34
- ンスです。詳しくはlicense/RUBYとlicense/GPLを見てください。
35
-
36
- == 依存ソフトウェア
37
-
38
- * Ruby >= 1.8 (1.9.1対応)
39
- * groonga >= 0.1.4
40
-
41
- == インストール
42
-
43
- % sudo gem install groonga
44
-
45
- == ドキュメント
46
-
47
- http://groonga.rubyforge.org/groonga/
48
-
49
- == メーリングリスト
50
-
51
- 質問、要望、バグ報告などはgroongaのMLにお願いします。
52
-
53
- http://lists.sourceforge.jp/mailman/listinfo/groonga-dev
54
-
55
- == 感謝
56
-
57
- * 森さん: 最新groonga対応パッチをくれました。
58
- * グニャラくん: バグレポートしてくれました。
59
- * にくさん: バグレポートしてくれました。
60
- * daraさん:
61
- * テストを書いてくれました。
62
- * バグを直してくれました。
63
- * id:mat_akiさん: チュートリアルのバグを教えてくれました。
data/README.rdoc DELETED
@@ -1,64 +0,0 @@
1
- = README
2
-
3
- == Name
4
-
5
- Ruby/groonga
6
-
7
- == Description
8
-
9
- Ruby bindings for groonga that provides full text search and
10
- column store features.
11
-
12
- Ruby/groonga is a extension library to use groonga's DB-API
13
- layer. Ruby/groonga provides Rubyish readable and writable
14
- API. You can use groonga's first and highly functional
15
- features from Ruby.
16
-
17
- See the following URL about groonga.
18
-
19
- * groonga: http://groonga.org/
20
-
21
- == Authors
22
-
23
- Kouhei Sutou:: <tt><kou@clear-code.com></tt>
24
- Tasuku SUENAGA:: <tt><a@razil.jp></tt>
25
- daijiro:: <tt><morita@razil.jp></tt>
26
- Yuto HAYAMIZU:: <tt><y.hayamizu@gmail.com></tt>
27
- SHIDARA Yoji:: <tt><dara@shidara.net></tt>
28
-
29
- == License
30
-
31
- LGPL 2.1. See license/LGPL for details.
32
-
33
- pkg-config.rb is a library that is bundled with rcairo. It's
34
- distributed under Ruby license. See license/RUBY and
35
- license/GPL for details.
36
-
37
- == Dependencies
38
-
39
- * Ruby >= 1.8 (including 1.9.1)
40
- * groonga >= 0.1.4
41
-
42
- == Install
43
-
44
- % sudo gem install groonga
45
-
46
- == Documents
47
-
48
- Japanese only. Sorry.
49
-
50
- http://groonga.rubyforge.org/groonga/
51
-
52
- == Mailing list
53
-
54
- http://rubyforge.org/mailman/listinfo/groonga-users-en
55
-
56
- == Thanks
57
-
58
- * mori: sent patches to support the latest groonga.
59
- * Tasuku SUENAGA: sent bug reports.
60
- * niku: sent bug reports.
61
- * dara:
62
- * wrote tests.
63
- * fixed bugs.
64
- * id:mat_aki: sent bug reports.
data/Rakefile DELETED
@@ -1,216 +0,0 @@
1
- # -*- coding: utf-8; mode: ruby -*-
2
- #
3
- # Copyright (C) 2009 Kouhei Sutou <kou@clear-code.com>
4
- #
5
- # This library is free software; you can redistribute it and/or
6
- # modify it under the terms of the GNU Lesser General Public
7
- # License version 2.1 as published by the Free Software Foundation.
8
- #
9
- # This library is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
- # Lesser General Public License for more details.
13
- #
14
- # You should have received a copy of the GNU Lesser General Public
15
- # License along with this library; if not, write to the Free Software
16
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
-
18
- require 'English'
19
-
20
- require 'find'
21
- require 'fileutils'
22
- require 'pathname'
23
- require 'erb'
24
- require 'rubygems'
25
- gem 'rdoc'
26
- require 'hoe'
27
-
28
- ENV["NODOT"] = "yes"
29
-
30
- base_dir = File.join(File.dirname(__FILE__))
31
- truncate_base_dir = Proc.new do |x|
32
- x.gsub(/^#{Regexp.escape(base_dir + File::SEPARATOR)}/, '')
33
- end
34
-
35
- groonga_ext_dir = File.join(base_dir, 'ext')
36
- groonga_lib_dir = File.join(base_dir, 'lib')
37
- $LOAD_PATH.unshift(groonga_ext_dir)
38
- $LOAD_PATH.unshift(groonga_lib_dir)
39
- ENV["RUBYLIB"] = "#{groonga_lib_dir}:#{groonga_ext_dir}:#{ENV['RUBYLIB']}"
40
-
41
- def guess_version
42
- require 'groonga'
43
- Groonga.bindings_version
44
- end
45
-
46
- groonga_win32_dir = "groonga"
47
- FileUtils.rm_rf(groonga_win32_dir)
48
-
49
- manifest = File.join(base_dir, "Manifest.txt")
50
- manifest_contents = []
51
- base_dir_included_components = %w(AUTHORS Rakefile
52
- README.rdoc README.ja.rdoc
53
- NEWS.rdoc NEWS.ja.rdoc
54
- extconf.rb pkg-config.rb)
55
- excluded_components = %w(.cvsignore .gdb_history CVS depend Makefile doc pkg
56
- .svn .git doc vendor data .test-result)
57
- excluded_suffixes = %w(.png .ps .pdf .o .so .a .txt .~)
58
- Find.find(base_dir) do |target|
59
- target = truncate_base_dir[target]
60
- components = target.split(File::SEPARATOR)
61
- if components.size == 1 and !File.directory?(target)
62
- next unless base_dir_included_components.include?(components[0])
63
- end
64
- Find.prune if (excluded_components - components) != excluded_components
65
- next if excluded_suffixes.include?(File.extname(target))
66
- manifest_contents << target if File.file?(target)
67
- end
68
-
69
- File.open(manifest, "w") do |f|
70
- f.puts manifest_contents.sort.join("\n")
71
- end
72
-
73
- # For Hoe's no user friendly default behavior. :<
74
- File.open("README.txt", "w") {|file| file << "= Dummy README\n== XXX\n"}
75
- FileUtils.cp("NEWS.rdoc", "History.txt")
76
- at_exit do
77
- FileUtils.rm_f("README.txt")
78
- FileUtils.rm_f("History.txt")
79
- FileUtils.rm_f(manifest)
80
- end
81
-
82
- def cleanup_white_space(entry)
83
- entry.gsub(/(\A\n+|\n+\z)/, '') + "\n"
84
- end
85
-
86
- ENV["VERSION"] ||= guess_version
87
- version = ENV["VERSION"]
88
- project = nil
89
- Hoe.spec('groonga') do |_project|
90
- Hoe::Test::SUPPORTED_TEST_FRAMEWORKS[:testunit2] = "test/run-test.rb"
91
- project = _project
92
- project.version = version
93
- project.rubyforge_name = 'groonga'
94
- authors = File.join(base_dir, "AUTHORS")
95
- project.author = File.readlines(authors).collect do |line|
96
- if /\s*<[^<>]*>$/ =~ line
97
- $PREMATCH
98
- else
99
- nil
100
- end
101
- end.compact
102
- project.email = ['groonga-users-en@rubyforge.org',
103
- 'groonga-dev@lists.sourceforge.jp']
104
- project.url = 'http://groonga.rubyforge.org/'
105
- project.testlib = :testunit2
106
- project.test_globs = ["test/run-test.rb"]
107
- project.spec_extras = {
108
- :extensions => ['extconf.rb'],
109
- :require_paths => ["lib", "ext"],
110
- :extra_rdoc_files => Dir.glob("**/*.rdoc"),
111
- }
112
- project.readme_file = "README.ja.rdoc"
113
-
114
- news_of_current_release = File.read("NEWS.rdoc").split(/^==\s.*$/)[1]
115
- project.changes = cleanup_white_space(news_of_current_release)
116
-
117
- entries = File.read("README.rdoc").split(/^==\s(.*)$/)
118
- description = cleanup_white_space(entries[entries.index("Description") + 1])
119
- project.summary, project.description, = description.split(/\n\n+/, 3)
120
-
121
- project.remote_rdoc_dir = "groonga"
122
- end
123
-
124
- project.spec.dependencies.delete_if {|dependency| dependency.name == "hoe"}
125
-
126
- if /mswin32/ =~ project.spec.platform.to_s
127
- project.spec.extensions = []
128
- project.spec.files += ["ext/groonga.so", "ext/libruby-groonga.a"]
129
-
130
- FileUtils.cp_r(File.expand_path("~/.wine/drive_c/groonga-dev"),
131
- groonga_win32_dir)
132
- groonga_files = []
133
- Find.find(groonga_win32_dir) do |f|
134
- groonga_files << f
135
- end
136
- project.spec.files += groonga_files
137
- end
138
-
139
- ObjectSpace.each_object(Rake::RDocTask) do |rdoc_task|
140
- options = rdoc_task.options
141
- t_option_index = options.index("--title") || options.index("-t")
142
- rdoc_task.options[t_option_index, 2] = nil
143
- rdoc_task.title = "Ruby/groonga - #{version}"
144
-
145
- rdoc_task.rdoc_files = ["ext/rb-groonga.c"] + Dir.glob("ext/rb-grn-*.c")
146
- rdoc_task.rdoc_files += Dir.glob("lib/**/*.rb")
147
- rdoc_task.rdoc_files += Dir.glob("**/*.rdoc")
148
- end
149
-
150
- task :publish_docs => [:prepare_docs_for_publishing]
151
-
152
-
153
- include ERB::Util
154
-
155
- def apply_template(file, head, header, footer)
156
- content = File.read(file)
157
- content = content.sub(/lang="en"/, 'lang="ja"')
158
-
159
- title = nil
160
- content = content.sub(/<title>(.+?)<\/title>/) do
161
- title = $1
162
- head.result(binding)
163
- end
164
-
165
- content = content.sub(/<body(?:.*?)>/) do |body_start|
166
- "#{body_start}\n#{header.result(binding)}\n"
167
- end
168
-
169
- content = content.sub(/<\/body/) do |body_end|
170
- "\n#{footer.result(binding)}\n#{body_end}"
171
- end
172
-
173
- File.open(file, "w") do |file|
174
- file.print(content)
175
- end
176
- end
177
-
178
- def erb_template(name)
179
- file = File.join("html", "#{name}.html.erb")
180
- template = File.read(file)
181
- erb = ERB.new(template, nil, "-")
182
- erb.filename = file
183
- erb
184
- end
185
-
186
- task :prepare_docs_for_publishing do
187
- head = erb_template("head")
188
- header = erb_template("header")
189
- footer = erb_template("footer")
190
- Find.find("doc") do |file|
191
- if /\.html\z/ =~ file and /_(?:c|rb)\.html\z/ !~ file
192
- apply_template(file, head, header, footer)
193
- end
194
- end
195
- end
196
-
197
- task :publish_html do
198
- config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
199
- host = "#{config["username"]}@rubyforge.org"
200
-
201
- rsync_args = "-av --exclude '*.erb' --exclude '*.svg' --exclude .svn"
202
- remote_dir = "/var/www/gforge-projects/#{project.rubyforge_name}/"
203
- sh "rsync #{rsync_args} html/ #{host}:#{remote_dir}"
204
- end
205
-
206
- task :tag do
207
- repository = "svn+ssh://rubyforge.org/var/svn/groonga/groonga"
208
- sh("svn cp -m 'release #{version}!!!' " +
209
- "#{repository}/trunk #{repository}/tags/#{version}")
210
- end
211
-
212
- # fix Hoe's incorrect guess.
213
- project.spec.executables.clear
214
- # project.lib_files = project.spec.files.grep(%r|^src/lib/|)
215
-
216
- task(:release).prerequisites.reject! {|name| name == "clean"}
data/benchmark/common.rb DELETED
@@ -1,49 +0,0 @@
1
- require 'benchmark'
2
- require 'tempfile'
3
-
4
- def memory_usage()
5
- status = `cat /proc/#{$$}/status`
6
- lines = status.split("\n")
7
- lines.each do |line|
8
- if line =~ /^VmRSS:/
9
- line.gsub!(/.*:\s*(\d+).*/, '\1')
10
- return line.to_i / 1024.0
11
- end
12
- end
13
- return -1;
14
- end
15
-
16
- @items = []
17
-
18
- def item(label, &block)
19
- @items << [label, block]
20
- end
21
-
22
- def report(index=0)
23
- width = @items.collect do |label, _|
24
- label.length
25
- end.max
26
-
27
- label, block = @items[index]
28
- if label.nil?
29
- puts "unavailable report ID: #{index}"
30
- puts "available IDs:"
31
- @items.each_with_index do |(label, block), i|
32
- puts "#{i}: #{label}"
33
- end
34
- exit 1
35
- end
36
-
37
- if index.zero?
38
- puts(" " * (width - 1) + Benchmark::Tms::CAPTION.rstrip + "memory".rjust(14))
39
- end
40
- # GC.disable
41
- before = memory_usage
42
- result = Benchmark.measure(&block)
43
- # GC.enable
44
- GC.start
45
- size = memory_usage - before
46
-
47
- formatted_size = "%10.3f" % size
48
- puts "#{label.ljust(width)} #{result.to_s.strip} #{formatted_size}MB"
49
- end
@@ -1,144 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- # This benchmark is based on Tokyo Cabinet's benchmark at
4
- # http://alpha.mixi.co.jp/blog/?p=791
5
- #
6
- # On my environment at 2009/07/14:
7
- # % for x in {0..9}; do ruby benchmark/read-write-many-small-items.rb $x; done
8
- # user system total real memory
9
- # Hash 0.850000 0.170000 1.020000 ( 1.050703) 46.957MB
10
- # groonga: Hash: memory 1.080000 0.180000 1.260000 ( 1.251981) 30.152MB
11
- # groonga: Trie: memory 1.300000 0.120000 1.420000 ( 1.429549) 22.199MB
12
- # groonga: Hash: file 1.070000 0.190000 1.260000 ( 1.276910) 30.156MB
13
- # groonga: Trie: file 1.280000 0.150000 1.430000 ( 1.423066) 22.203MB
14
- # Localmemcache: file 1.320000 0.150000 1.470000 ( 1.497013) 45.984MB
15
- # TC: Hash: memory 0.940000 0.250000 1.190000 ( 1.248141) 48.758MB
16
- # TC: Tree: memory 0.890000 0.140000 1.030000 ( 1.067693) 37.270MB
17
- # TC: Hash: file 1.740000 2.390000 4.130000 ( 4.141555) 8.848MB
18
- # TC: Tree: file 1.290000 0.180000 1.470000 ( 1.476853) 12.805MB
19
- #
20
- # CPU: Intel(R) Core(TM)2 Duo 2.33GHz
21
- # Memory: 2GB
22
- # Ruby: Debian GNU/Linux sid at 2009/07/14:
23
- # ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux]
24
- # groonga: HEAD at 2009/07/14: fdaf58df5dd0195c10624eabee3e3f522f4af3f9
25
- # Ruby/Groonga: trunk at 2009/07/14: r479
26
- # Localmemcache: HEAD at 2009/07/14: 3121629016344dfd10f7533ca8ec68a0006cca21
27
- # Tokyo Cabinet: 1.4.29
28
- # Tokyo Cabinet Ruby: 1.27
29
- #
30
- # NOTE:
31
- # * groonga, Localmemcache and Tokyo Cabinet are built with "-O3" option.
32
- # * Ruby bindings of them are built with "-O2" option.
33
-
34
- require File.join(File.dirname(__FILE__), "common.rb")
35
-
36
- n = 500000
37
-
38
- values = []
39
- n.times do |i|
40
- values << "%08d" % i
41
- end
42
-
43
- item("Hash") do
44
- @hash = {}
45
- values.each do |value|
46
- @hash[value] = value
47
- @hash[value]
48
- end
49
- end
50
-
51
- begin
52
- base_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
53
- $LOAD_PATH.unshift(File.join(base_dir, "ext"))
54
- $LOAD_PATH.unshift(File.join(base_dir, "lib"))
55
-
56
- require 'groonga'
57
- tmp_dir = "/tmp/groonga"
58
- FileUtils.rm_rf(tmp_dir)
59
- FileUtils.mkdir(tmp_dir)
60
- @database = Groonga::Database.create(:path => "#{tmp_dir}/db")
61
-
62
- item("groonga: Hash: file") do
63
- @hash = Groonga::Hash.create(:name => "Hash",
64
- :key_type => "ShortText")
65
- column_name = "value"
66
- @column = @hash.define_column(column_name, "ShortText")
67
- values.each do |value|
68
- @hash.set_column_value(value, column_name, value)
69
- @hash.column_value(value, column_name)
70
- end
71
- end
72
-
73
- item("groonga: Trie: file") do
74
- @trie = Groonga::PatriciaTrie.create(:name => "PatriciaTrie",
75
- :key_type => "ShortText")
76
- column_name = "value"
77
- @column = @trie.define_column(column_name, "ShortText")
78
- values.each do |value|
79
- @trie.set_column_value(value, column_name, value)
80
- @trie.column_value(value, column_name)
81
- end
82
- end
83
- rescue LoadError
84
- end
85
-
86
- begin
87
- require 'localmemcache'
88
-
89
- item("Localmemcache: file") do
90
- LocalMemCache.drop(:namespace => "read-write-many-small-items",
91
- :force => true)
92
- @db = LocalMemCache.new(:namespace => "read-write-many-small-items")
93
- values.each do |value|
94
- @db[value] = value
95
- @db[value]
96
- end
97
- end
98
- rescue LoadError
99
- end
100
-
101
- begin
102
- require 'tokyocabinet'
103
-
104
- item("TC: Hash: memory") do
105
- @db = TokyoCabinet::ADB::new
106
- @db.open("*#bnum=#{n}#mode=wct#xmsiz=0")
107
- values.each do |value|
108
- @db.put(value, value)
109
- @db.get(value)
110
- end
111
- end
112
-
113
- item("TC: Tree: memory") do
114
- @db = TokyoCabinet::ADB::new
115
- @db.open("+#bnum=#{n}#mode=wct#xmsiz=0")
116
- values.each do |value|
117
- @db.put(value, value)
118
- @db.get(value)
119
- end
120
- end
121
-
122
- hash_file = Tempfile.new(["tc-hash", ".tch"])
123
- item("TC: Hash: file") do
124
- @db = TokyoCabinet::ADB::new
125
- @db.open("#{hash_file.path}#bnum=#{n}#mode=wct#xmsiz=0")
126
- values.each do |value|
127
- @db.put(value, value)
128
- @db.get(value)
129
- end
130
- end
131
-
132
- tree_file = Tempfile.new(["tc-tree", ".tcb"])
133
- item("TC: Tree: file") do
134
- @db = TokyoCabinet::ADB::new
135
- @db.open("#{tree_file.path}#bnum=#{n}#mode=wct#xmsiz=0")
136
- values.each do |value|
137
- @db.put(value, value)
138
- @db.get(value)
139
- end
140
- end
141
- rescue LoadError
142
- end
143
-
144
- report(Integer(ARGV[0] || 0))