This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/examples/scheme.rb b/examples/scheme.rb | |
index 52e5f98..b06c1e7 100755 | |
--- a/examples/scheme.rb | |
+++ b/examples/scheme.rb | |
@@ -5,12 +5,12 @@ require 'pp' | |
class User < Swift::Scheme | |
store :users | |
- attribute :id, Swift::Type::Integer, serial: true, key: true | |
- attribute :name, Swift::Type::String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./simple.sh -d mysql -r 10000 -n 1 | |
-- driver: mysql rows: 10000 runs: 1 -- | |
user system total real | |
dm #create 3.600000 0.520000 4.120000 ( 7.527122) | |
dm #select 1.890000 0.100000 1.990000 ( 1.997144) | |
dm #update 7.750000 0.720000 8.470000 ( 11.151092) | |
virt: 1051076kB res: 1003404kB | |
user system total real |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* DataMapper, Active Record and Swift comparisons with GC disabled. | |
* #create runs once creating the rows. | |
* #select and #update iterates through them <runs> times. | |
* memory usage is measured as (total rss of process after - before) benchmark is run. | |
-- driver: mysql rows: 5000 runs: 5 -- | |
benchmark sys user total real rss | |
dm #create 0.170000 1.780000 1.950000 3.655825 108.36m | |
dm #select 0.300000 4.420000 4.720000 4.739661 322.62m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Rack | |
class InputEncoder | |
def initialize app | |
@app = app | |
end | |
def call env | |
env["rack.input"] = IO.new(env["rack.input"]) | |
@app.call(env) | |
end | |
class IO < DelegateClass(IO) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'pp' | |
sets = [ | |
[1, 2, 3], | |
[10, 20, 30, 40, 50, 55, 56], | |
[100, 200, 300, 400, 500, 600, 700] | |
] | |
scale = sets.flatten.max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'gems/environment' | |
require 'em-jack' | |
require 'em-http' | |
EM.run do | |
jack = EMJack::Connection.new | |
jack.use('stalk') do | |
5.times {|n| jack.put "hello #{n+1}" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/examples/db.rb b/examples/db.rb | |
index da5b728..c43daf1 100755 | |
--- a/examples/db.rb | |
+++ b/examples/db.rb | |
@@ -8,9 +8,9 @@ require 'swift/migrations' | |
class User < Swift::Scheme | |
store :users | |
- attribute :id, Swift::Type::Integer, serial: true, key: true | |
- attribute :name, Swift::Type::String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/examples/associations.rb b/examples/associations.rb | |
new file mode 100755 | |
index 0000000..27d95f5 | |
--- /dev/null | |
+++ b/examples/associations.rb | |
@@ -0,0 +1,53 @@ | |
+#!/usr/bin/env ruby | |
+ | |
+$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) | |
+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ruby/ruby.h> | |
#include <time.h> | |
#include <unistd.h> | |
#define CONST_GET(scope, constant) rb_const_get(scope, rb_intern(constant)) | |
VALUE day_secs; | |
VALUE cDateTime; | |
VALUE fNewBang; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ruby.h> | |
VALUE blocking_function(void *data) { | |
throw "die die die"; | |
} | |
VALUE run(VALUE self) { | |
try { | |
rb_thread_blocking_region(blocking_function, 0, 0, 0); | |
} |