Permalink
Browse files

almost there.

  • Loading branch information...
1 parent 451aca9 commit 2b70eb9621ea0d908f4e3641d8159ed15421edd7 @ciconia ciconia committed Jan 2, 2008
@@ -1,6 +1,6 @@
require 'rubygems'
require 'faster_csv'
-require File.join(File.dirname(__FILE__), '../lib/sequel/sqlite')
+require File.join(File.dirname(__FILE__), '../lib/sequel_core')
DB = Sequel.open 'sqlite:///test.db'
DB.create_table :countries do
@@ -1,5 +1,5 @@
require 'rubygems'
-require File.join(File.dirname(__FILE__), '../lib/sequel/sqlite')
+require File.join(File.dirname(__FILE__), '../lib/sequel_core')
db = Sequel.open("sqlite:/:memory:")
db << "create table k1 (id integer primary key autoincrement, f1 text)"
@@ -559,7 +559,7 @@ class CCC < Sequel::Database
context "A broken adapter (lib is there but the class is not)" do
setup do
- @fn = File.join(File.dirname(__FILE__), '../lib/sequel/adapters/blah.rb')
+ @fn = File.join(File.dirname(__FILE__), '../lib/sequel_core/adapters/blah.rb')
FileUtils.touch(@fn)
end
@@ -8,7 +8,7 @@ def require(*args); raise LoadError; end
end
old_verbose = $VERBOSE
$VERBOSE = nil
- load(File.join(File.dirname(__FILE__), '../lib/sequel/dataset/sequelizer.rb'))
+ load(File.join(File.dirname(__FILE__), '../lib/sequel_core/dataset/sequelizer.rb'))
$VERBOSE = old_verbose
@db = Sequel::Database.new
@ds = @db[:items]
@@ -20,7 +20,7 @@ module Kernel
end
old_verbose = $VERBOSE
$VERBOSE = nil
- load(File.join(File.dirname(__FILE__), '../lib/sequel/dataset/sequelizer.rb'))
+ load(File.join(File.dirname(__FILE__), '../lib/sequel_core/dataset/sequelizer.rb'))
$VERBOSE = old_verbose
end
@@ -37,7 +37,7 @@ def require(name); raise LoadError if name == 'ruby2ruby'; end
end
old_verbose = $VERBOSE
$VERBOSE = nil
- load(File.join(File.dirname(__FILE__), '../lib/sequel/dataset/sequelizer.rb'))
+ load(File.join(File.dirname(__FILE__), '../lib/sequel_core/dataset/sequelizer.rb'))
$VERBOSE = old_verbose
@db = Sequel::Database.new
@ds = @db[:items]
@@ -49,7 +49,7 @@ module Kernel
end
old_verbose = $VERBOSE
$VERBOSE = nil
- load(File.join(File.dirname(__FILE__), '../lib/sequel/dataset/sequelizer.rb'))
+ load(File.join(File.dirname(__FILE__), '../lib/sequel_core/dataset/sequelizer.rb'))
$VERBOSE = old_verbose
end
@@ -1,6 +1,6 @@
require 'benchmark'
require 'rubygems'
-require File.join(File.dirname(__FILE__), '../lib/sequel/sqlite')
+require File.join(File.dirname(__FILE__), '../lib/sequel_core/adapters/sqlite')
DB = Sequel.sqlite
@@ -1,6 +1,6 @@
require 'benchmark'
require 'rubygems'
-require File.join(File.dirname(__FILE__), '../lib/sequel/sqlite')
+require File.join(File.dirname(__FILE__), '../lib/sequel_core/adapters/sqlite')
DB = Sequel.sqlite
@@ -1,6 +1,6 @@
require 'benchmark'
require 'rubygems'
- require File.join(File.dirname(__FILE__), '../lib/sequel/sqlite')
+ require File.join(File.dirname(__FILE__), '../lib/sequel_core/adapters/sqlite')
DB = Sequel.sqlite
DS = DB[:t]
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '../lib/sequel/array_keys')
+require File.join(File.dirname(__FILE__), '../lib/sequel_core/array_keys')
require 'benchmark'
N = 50_000
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '../lib/sequel/array_keys')
+require File.join(File.dirname(__FILE__), '../lib/sequel_core/array_keys')
N = 100_000
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '../lib/sequel/array_keys')
+require File.join(File.dirname(__FILE__), '../lib/sequel_core/array_keys')
N = 100_000
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '../lib/sequel/array_keys')
+require File.join(File.dirname(__FILE__), '../lib/sequel_core/array_keys')
N = 100_000
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '../lib/sequel/array_keys')
+require File.join(File.dirname(__FILE__), '../lib/sequel_core/array_keys')
N = 100_000
@@ -1,7 +1,7 @@
require 'benchmark'
require 'rubygems'
# require 'fastthread'
-require File.join(File.dirname(__FILE__), '../lib/sequel/postgres')
+require File.join(File.dirname(__FILE__), '../lib/sequel_core/adapters/postgres')
DB = Sequel('postgres://postgres:postgres@localhost:5432/reality_development')
@@ -1,5 +1,5 @@
require 'rubygems'
-require File.join(File.dirname(__FILE__), '../lib/sequel/sqlite')
+require File.join(File.dirname(__FILE__), '../lib/sequel_core/adapters/sqlite')
DB = Sequel.sqlite
DS = DB[:t]
@@ -14,13 +14,13 @@ def initialize(kernel=Kernel, separator=File::SEPARATOR, alt_separator=File::ALT
# since Ruby compares the REGEXP source, not the resulting pattern
@test_mappings = {
%r%^spec/.*_spec\.rb$% => kernel.proc { |filename, _| filename },
- %r%^lib/sequel/(.*)\.rb$% => kernel.proc do |_, m|
+ %r%^lib/sequel_core/(.*)\.rb$% => kernel.proc do |_, m|
[
"spec/#{m[1]}_spec.rb",
"spec/sequel/#{m[1]}_spec.rb"
]
end,
- %r%^lib/sequel/model/(.*)\.rb$% => kernel.proc do |_, m|
+ %r%^lib/sequel_model/(.*)\.rb$% => kernel.proc do |_, m|
[
"spec/model/#{m[1]}_spec.rb"#,
#"spec/sequel/#{m[1]}_spec.rb",
@@ -1,22 +0,0 @@
-require 'benchmark'
-require 'rubygems'
-require File.join(File.dirname(__FILE__), '../lib/sequel/sqlite')
-
-DB = Sequel.sqlite
-
-DB.create_table :items do
- text :name
- integer :price
-end
-
-N = 10_000
-
-N.times {DB[:items] << {:name => rand(10000).to_s, :price => rand(10000)}}
-
-# DB[:items].print
-
-Benchmark::bmbm(20) do |x|
- x.report('access') do
- DB[:items].each {|r| r[:name]; r[:price]}
- end
-end
@@ -1,29 +0,0 @@
-require 'benchmark'
-require 'rubygems'
-require File.join(File.dirname(__FILE__), '../lib/sequel/sqlite')
-
-DB = Sequel.sqlite
-
-N = 10_000
-
-Benchmark::bm(20) do |x|
- x.report('from') do
- t = DB[:test]
- N.times { t.sql }
- end
-
- x.report('order') do
- t = DB[:test].order(:stamp)
- N.times { t.sql }
- end
-
- x.report('filter') do
- t = DB[:test].filter {:stamp < (Time.now - 3600)}
- N.times { t.sql }
- end
-
- x.report('filter.order') do
- t = DB[:test].filter {:stamp < (Time.now - 3600)}.order(:stamp)
- N.times { t.sql }
- end
-end
@@ -1,26 +0,0 @@
- require 'benchmark'
- require 'rubygems'
- require File.join(File.dirname(__FILE__), '../lib/sequel/sqlite')
-
- DB = Sequel.sqlite
- DS = DB[:t]
-
- N = 10_000
-
- Benchmark::bm(6) do |x|
- x.report('hash') do
- N.times {DS.filter(:x => 100, :y => 200).sql}
- end
-
- x.report('param') do
- N.times {DS.filter('(x = ?) AND (y = ?)', 200).sql}
- end
-
- x.report('string') do
- N.times {DS.filter('(x = 100) AND (y = 200)').sql}
- end
-
- x.report('proc') do
- N.times {DS.filter {:x == 100 && :y == 200}.sql}
- end
- end
@@ -1,63 +0,0 @@
-require File.join(File.dirname(__FILE__), '../lib/sequel/array_keys')
-require 'benchmark'
-
-N = 50_000
-
-puts "pid = #{Process.pid}"
-
-Benchmark::bm(30) do |x|
- keys = [:a, :b, :c, :d, :e]
-
- rows = []
-
- x.report('create hash') do
- N.times do
- values = [rand] * 5
- rows << keys.inject({}) {|m, k| m[k] = values.shift; m}
- end
- end
-
- rows = []
-
- x.report('create array with keys') do
- N.times do
- values = [rand] * 5
- values.keys = keys
- rows << values
- end
- end
-
- hashes = [{:a => 1, :b => 2, :c => 3, :d => 4, :e => 5}] * N
- values = [rand] * 5
- values.keys = keys
- arrays = [values] * N
-
- x.report('access hash') do
- hashes.each {|h| h[:a]}
- end
-
- x.report('access array with keys') do
- arrays.each {|a| a[:a]}
- end
-
- require 'rubygems'
- require 'arrayfields'
-
- rows = []
-
- x.report('create array with arrayfields') do
- N.times do
- values = [rand] * 5
- values.fields = keys
- rows << values
- end
- end
-
- values = [rand] * 5
- values.fields = keys
- arrays = [values] * N
- x.report('access array with arrayfields') do
- arrays.each {|a| a[:a]}
- end
-end
-
@@ -1,16 +0,0 @@
-require File.join(File.dirname(__FILE__), '../lib/sequel/array_keys')
-
-N = 100_000
-
-puts "pid = #{Process.pid}"
-
-keys = [:a, :b, :c, :d, :e]
-
-rows = []
-
-N.times do
- values = [rand] * 5
- rows << values
-end
-
-loop {sleep 1}
@@ -1,19 +0,0 @@
-require File.join(File.dirname(__FILE__), '../lib/sequel/array_keys')
-
-N = 100_000
-
-puts "pid = #{Process.pid}"
-
-keys = [:a, :b, :c, :d, :e]
-
-require 'rubygems'
-require 'arrayfields'
-
-rows = []
-N.times do
- values = [rand] * 5
- values.fields = keys
- rows << values
-end
-
-loop {sleep 1}
@@ -1,17 +0,0 @@
-require File.join(File.dirname(__FILE__), '../lib/sequel/array_keys')
-
-N = 100_000
-
-puts "pid = #{Process.pid}"
-
-keys = [:a, :b, :c, :d, :e]
-
-rows = []
-
-N.times do
- values = [rand] * 5
- values.keys = keys
- rows << values
-end
-
-loop {sleep 1}
@@ -1,16 +0,0 @@
-require File.join(File.dirname(__FILE__), '../lib/sequel/array_keys')
-
-N = 100_000
-
-puts "pid = #{Process.pid}"
-
-keys = [:a, :b, :c, :d, :e]
-
-rows = []
-
-N.times do
- values = [rand] * 5
- rows << keys.inject({}) {|m, k| m[k] = values.shift; m}
-end
-
-loop {sleep 1}
@@ -1,16 +0,0 @@
-require 'benchmark'
-require 'rubygems'
-# require 'fastthread'
-require File.join(File.dirname(__FILE__), '../lib/sequel/postgres')
-
-DB = Sequel('postgres://postgres:postgres@localhost:5432/reality_development')
-
-N = 100
-
-Benchmark::bmbm(20) do |x|
- x.report('postgres read') do
- N.times do
- DB[:timeline].each {|t| [t[:stamp], t[:kind], t[:node_id]]}
- end
- end
-end
@@ -1,10 +0,0 @@
-require 'rubygems'
-require File.join(File.dirname(__FILE__), '../lib/sequel/sqlite')
-
-DB = Sequel.sqlite
-DS = DB[:t]
-
-N = 10_000
-require 'profile'
-
-N.times {DS.filter {:x == 100}.sql}

0 comments on commit 2b70eb9

Please sign in to comment.