Guest User

Untitled

a guest
May 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. # encoding: UTF-8
  2. $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
  3.  
  4. require 'rubygems'
  5. require 'benchmark'
  6. require 'sequel'
  7.  
  8. number_of = 10
  9. mysql2_opts = {
  10. :adapter => 'mysql2',
  11. :database => 'test'
  12. }
  13. mysql_opts = {
  14. :adapter => 'mysql',
  15. :database => 'test'
  16. }
  17. class Mysql2Model < Sequel::Model(Sequel.connect(mysql2_opts)[:mysql2_test]); end
  18. class MysqlModel < Sequel::Model(Sequel.connect(mysql_opts)[:mysql2_test]); end
  19.  
  20. Benchmark.bmbm do |x|
  21. x.report do
  22. puts "Mysql2"
  23. number_of.times do
  24. Mysql2Model.limit(1000).all
  25. end
  26. end
  27.  
  28. x.report do
  29. puts "Mysql"
  30. number_of.times do
  31. MysqlModel.limit(1000).all
  32. end
  33. end
  34. end
Add Comment
Please, Sign In to add comment