-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pg gem scope_all benchmark #76
Conversation
c9f4cfd
to
5c64a99
Compare
5175d96
to
e2025e7
Compare
5b94f74
to
24b639d
Compare
|
||
Benchmark.pg("raw_pg/postgres_scope_all", time: 5) do | ||
str = "" | ||
conn.exec("SELECT * FROM users").each_row{ |row| str << "name: #{row[0]} email: #{row[1]}\n" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interestingly this can be done a fraction quicker if you avoid the #each_row and instead just use a double while loop iteration cause you can avoid a bunch of block transitions, its very very minor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SamSaffron interesing note 🤔 I guess I should leave it as it is because I used iterating blocks in other scope_all benchmarks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, it is a distraction, we should focus on getting that graph up on ruby bench, 3 lines on one benchmark
@tgxworld can we merge this? |
pg/benchmarks/pg_scope_all.rb
Outdated
require 'pg' | ||
require_relative 'support/benchmark_pg' | ||
|
||
# Connect to POSTGRES database with provided values or use default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll prefer if we leave out the comment here. I believe the code is self explanatory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tgxworld yeah, It is. I was kind of in doubt because of defaults. I'll leave it out 👍
pg/benchmarks/pg_scope_all.rb
Outdated
require_relative 'support/benchmark_pg' | ||
|
||
# Connect to POSTGRES database with provided values or use default | ||
conn = PG.connect(host: ENV.fetch("HOST", "localhost"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer
conn = PG.connect(
host: ENV.fetch("HOST", "localhost"),
port: ..
)
The problem I have with flushing indentations is that changing anything in the first line forces us to re-indent all the lines polluting the commit history.
@tgxworld, fixed stuff you've suggested :) |
As Noah mentioned in #79, there's a tiny schema inconsistency. Is that intentional that the Looks great though ! 👍 |
Nice catch! I omitted Although none of scope_all benchmarks has admin field in schema. Admin field is present only in default_scope benchmarks. I am not sure if scope_all benchmarks are about to be compared with default_scope benchmarks, these two are of different type. I had only in mind comparing scope_all (or default_scope) across AR, sequel or pg implementations. |
Yeah, you're right Marko ! That looks great then ! |
5551242
to
47d07a1
Compare
47d07a1
to
3113716
Compare
@tgxworld The next step would be to make and push docker image for pg suite. |
@bmarkons Sorry for missing this. I guess we should enable this since the benchmarks have been added :) |
Sure, I am writing driver for pg suite right now and Dockerfile.. :) |
Add pg suite with
pg/postgres_scope_all
benchmark.