extralite-bundle 2.5 → 2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +34 -13
  4. data/Gemfile +4 -0
  5. data/Gemfile-bundle +1 -1
  6. data/LICENSE +1 -1
  7. data/README.md +1059 -247
  8. data/Rakefile +18 -0
  9. data/TODO.md +0 -7
  10. data/examples/kv_store.rb +49 -0
  11. data/examples/multi_fiber.rb +16 -0
  12. data/examples/on_progress.rb +9 -0
  13. data/examples/pubsub_store_polyphony.rb +194 -0
  14. data/examples/pubsub_store_threads.rb +204 -0
  15. data/ext/extralite/changeset.c +463 -0
  16. data/ext/extralite/common.c +177 -91
  17. data/ext/extralite/database.c +745 -276
  18. data/ext/extralite/extconf-bundle.rb +10 -4
  19. data/ext/extralite/extconf.rb +34 -34
  20. data/ext/extralite/extralite.h +104 -47
  21. data/ext/extralite/extralite_ext.c +6 -0
  22. data/ext/extralite/iterator.c +14 -86
  23. data/ext/extralite/query.c +171 -264
  24. data/extralite-bundle.gemspec +1 -1
  25. data/extralite.gemspec +1 -1
  26. data/gemspec.rb +10 -11
  27. data/lib/extralite/version.rb +1 -1
  28. data/lib/extralite.rb +69 -10
  29. data/lib/sequel/adapters/extralite.rb +1 -1
  30. data/test/helper.rb +9 -1
  31. data/test/perf_argv_transform.rb +74 -0
  32. data/test/perf_ary.rb +14 -12
  33. data/test/perf_hash.rb +17 -15
  34. data/test/perf_hash_prepared.rb +58 -0
  35. data/test/perf_hash_transform.rb +66 -0
  36. data/test/perf_polyphony.rb +74 -0
  37. data/test/test_changeset.rb +161 -0
  38. data/test/test_database.rb +720 -104
  39. data/test/test_extralite.rb +2 -2
  40. data/test/test_iterator.rb +28 -13
  41. data/test/test_query.rb +352 -110
  42. data/test/test_sequel.rb +4 -4
  43. metadata +24 -16
  44. data/Gemfile.lock +0 -37
  45. data/test/perf_prepared.rb +0 -64
data/test/test_sequel.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  require_relative 'helper'
4
4
  require 'sequel'
5
5
 
6
- class SequelExtraliteTest < MiniTest::Test
6
+ class SequelExtraliteTest < Minitest::Test
7
7
  def setup
8
8
  @db = Sequel.connect('extralite::memory:')
9
9
  @db.create_table :items do
@@ -46,8 +46,8 @@ class SequelExtraliteTest < MiniTest::Test
46
46
 
47
47
  def test_migration
48
48
  # Adapted from https://github.com/digital-fabric/extralite/issues/8
49
- Dir.mktmpdir("extralite-migration") do |dir|
50
- File.write(dir + "/001_migrate.rb", <<~RUBY)
49
+ Dir.mktmpdir('extralite-migration') do |dir|
50
+ File.write(dir + '/001_migrate.rb', <<~RUBY)
51
51
  Sequel.migration do
52
52
  change do
53
53
  create_table(:foobars) { primary_key :id }
@@ -56,7 +56,7 @@ class SequelExtraliteTest < MiniTest::Test
56
56
  RUBY
57
57
 
58
58
  Sequel.extension :migration
59
- db = Sequel.connect("extralite://")
59
+ db = Sequel.connect('extralite://')
60
60
  Sequel::Migrator.run(db, dir)
61
61
 
62
62
  assert_equal [:id], db[:foobars].columns
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extralite-bundle
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.5'
4
+ version: '2.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-16 00:00:00.000000000 Z
11
+ date: 2024-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.1.6
19
+ version: 1.2.7
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.1.6
26
+ version: 1.2.7
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 5.15.0
33
+ version: 5.21.2
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 5.15.0
40
+ version: 5.21.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: simplecov
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.9.27
61
+ version: 0.9.34
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.9.27
68
+ version: 0.9.34
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sequel
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 5.51.0
75
+ version: 5.77.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 5.51.0
82
+ version: 5.77.0
83
83
  description:
84
84
  email: sharon@noteflakes.com
85
85
  executables: []
@@ -97,12 +97,17 @@ files:
97
97
  - CHANGELOG.md
98
98
  - Gemfile
99
99
  - Gemfile-bundle
100
- - Gemfile.lock
101
100
  - LICENSE
102
101
  - README.md
103
102
  - Rakefile
104
103
  - TODO.md
105
104
  - bin/update_sqlite_source
105
+ - examples/kv_store.rb
106
+ - examples/multi_fiber.rb
107
+ - examples/on_progress.rb
108
+ - examples/pubsub_store_polyphony.rb
109
+ - examples/pubsub_store_threads.rb
110
+ - ext/extralite/changeset.c
106
111
  - ext/extralite/common.c
107
112
  - ext/extralite/database.c
108
113
  - ext/extralite/extconf-bundle.rb
@@ -128,10 +133,14 @@ files:
128
133
  - test/issue-38.rb
129
134
  - test/issue-54.rb
130
135
  - test/issue-59.rb
136
+ - test/perf_argv_transform.rb
131
137
  - test/perf_ary.rb
132
138
  - test/perf_hash.rb
133
- - test/perf_prepared.rb
139
+ - test/perf_hash_prepared.rb
140
+ - test/perf_hash_transform.rb
141
+ - test/perf_polyphony.rb
134
142
  - test/run.rb
143
+ - test/test_changeset.rb
135
144
  - test/test_database.rb
136
145
  - test/test_extralite.rb
137
146
  - test/test_iterator.rb
@@ -141,14 +150,13 @@ homepage: https://github.com/digital-fabric/extralite
141
150
  licenses:
142
151
  - MIT
143
152
  metadata:
144
- source_code_uri: https://github.com/digital-fabric/extralite
145
- documentation_uri: https://www.rubydoc.info/gems/extralite
146
153
  homepage_uri: https://github.com/digital-fabric/extralite
154
+ documentation_uri: https://www.rubydoc.info/gems/extralite
147
155
  changelog_uri: https://github.com/digital-fabric/extralite/blob/master/CHANGELOG.md
148
156
  post_install_message:
149
157
  rdoc_options:
150
158
  - "--title"
151
- - extralite
159
+ - Extralite
152
160
  - "--main"
153
161
  - README.md
154
162
  require_paths:
@@ -164,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
172
  - !ruby/object:Gem::Version
165
173
  version: '0'
166
174
  requirements: []
167
- rubygems_version: 3.4.1
175
+ rubygems_version: 3.5.3
168
176
  signing_key:
169
177
  specification_version: 4
170
178
  summary: Extra-lightweight SQLite3 wrapper for Ruby with bundled SQLite3
data/Gemfile.lock DELETED
@@ -1,37 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- extralite (2.5)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- docile (1.4.0)
10
- json (2.7.1)
11
- minitest (5.15.0)
12
- rake (13.1.0)
13
- rake-compiler (1.1.6)
14
- rake
15
- sequel (5.51.0)
16
- simplecov (0.17.1)
17
- docile (~> 1.1)
18
- json (>= 1.8, < 3)
19
- simplecov-html (~> 0.10.0)
20
- simplecov-html (0.10.2)
21
- webrick (1.7.0)
22
- yard (0.9.27)
23
- webrick (~> 1.7.0)
24
-
25
- PLATFORMS
26
- ruby
27
-
28
- DEPENDENCIES
29
- extralite!
30
- minitest (= 5.15.0)
31
- rake-compiler (= 1.1.6)
32
- sequel (= 5.51.0)
33
- simplecov (= 0.17.1)
34
- yard (= 0.9.27)
35
-
36
- BUNDLED WITH
37
- 2.4.22
@@ -1,64 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/inline'
4
-
5
- gemfile do
6
- source 'https://rubygems.org'
7
- gem 'extralite', path: '..'
8
- gem 'sqlite3'
9
- gem 'benchmark-ips'
10
- end
11
-
12
- require 'benchmark/ips'
13
- require 'fileutils'
14
-
15
- DB_PATH = '/tmp/extralite_sqlite3_perf.db'
16
-
17
- def prepare_database(count)
18
- FileUtils.rm(DB_PATH) rescue nil
19
- db = Extralite::Database.new(DB_PATH)
20
- db.query('create table foo ( a integer primary key, b text )')
21
- db.query('begin')
22
- count.times { db.query('insert into foo (b) values (?)', "hello#{rand(1000)}" )}
23
- db.query('commit')
24
- end
25
-
26
- def sqlite3_prepare
27
- db = SQLite3::Database.new(DB_PATH, :results_as_hash => true)
28
- db.prepare('select * from foo')
29
- end
30
-
31
- def sqlite3_run(stmt, count)
32
- # db = SQLite3::Database.new(DB_PATH, :results_as_hash => true)
33
- results = stmt.execute.to_a
34
- raise unless results.size == count
35
- end
36
-
37
- def extralite_prepare
38
- db = Extralite::Database.new(DB_PATH)
39
- db.prepare('select * from foo')
40
- end
41
-
42
- def extralite_run(query, count)
43
- # db = Extralite::Database.new(DB_PATH)
44
- results = query.to_a
45
- raise unless results.size == count
46
- end
47
-
48
- [10, 1000, 100000].each do |c|
49
- puts; puts; puts "Record count: #{c}"
50
-
51
- prepare_database(c)
52
-
53
- sqlite3_stmt = sqlite3_prepare
54
- extralite_stmt = extralite_prepare
55
-
56
- Benchmark.ips do |x|
57
- x.config(:time => 3, :warmup => 1)
58
-
59
- x.report("sqlite3") { sqlite3_run(sqlite3_stmt, c) }
60
- x.report("extralite") { extralite_run(extralite_stmt, c) }
61
-
62
- x.compare!
63
- end
64
- end