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

Merged
merged 1 commit into from Jul 26, 2017

Conversation

Projects
None yet
4 participants
@bmarkons
Copy link
Collaborator

bmarkons commented May 14, 2017

Add pg suite with pg/postgres_scope_all benchmark.

@bmarkons bmarkons force-pushed the bmarkons:add-bm-raw-scope-all branch 3 times, most recently from c9f4cfd to 5c64a99 May 15, 2017

@bmarkons bmarkons changed the title Add raw scope_all benchmark Add raw scope_all benchmark [wip] May 15, 2017

@bmarkons bmarkons force-pushed the bmarkons:add-bm-raw-scope-all branch 2 times, most recently from 5175d96 to e2025e7 May 15, 2017

@bmarkons bmarkons changed the title Add raw scope_all benchmark [wip] Add raw scope_all benchmark May 16, 2017

@bmarkons bmarkons force-pushed the bmarkons:add-bm-raw-scope-all branch 4 times, most recently from 5b94f74 to 24b639d May 16, 2017

@bmarkons bmarkons changed the title Add raw scope_all benchmark Add pg gem scope_all benchmark May 17, 2017


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" }

This comment has been minimized.

@SamSaffron

SamSaffron May 22, 2017

Member

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

This comment has been minimized.

@bmarkons

bmarkons May 23, 2017

Collaborator

@SamSaffron interesing note 🤔 I guess I should leave it as it is because I used iterating blocks in other scope_all benchmarks?

This comment has been minimized.

@SamSaffron

SamSaffron May 23, 2017

Member

yeah, it is a distraction, we should focus on getting that graph up on ruby bench, 3 lines on one benchmark

@SamSaffron

This comment has been minimized.

Copy link
Member

SamSaffron commented May 22, 2017

@tgxworld can we merge this?

require 'pg'
require_relative 'support/benchmark_pg'

# Connect to POSTGRES database with provided values or use default

This comment has been minimized.

@tgxworld

tgxworld May 23, 2017

Member

I'll prefer if we leave out the comment here. I believe the code is self explanatory.

This comment has been minimized.

@bmarkons

bmarkons May 23, 2017

Collaborator

@tgxworld yeah, It is. I was kind of in doubt because of defaults. I'll leave it out 👍

require_relative 'support/benchmark_pg'

# Connect to POSTGRES database with provided values or use default
conn = PG.connect(host: ENV.fetch("HOST", "localhost"),

This comment has been minimized.

@tgxworld

tgxworld May 23, 2017

Member

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.

@bmarkons

This comment has been minimized.

Copy link
Collaborator

bmarkons commented May 23, 2017

@tgxworld, fixed stuff you've suggested :)

@robin850

This comment has been minimized.

Copy link
Member

robin850 commented May 29, 2017

As Noah mentioned in #79, there's a tiny schema inconsistency. Is that intentional that the admin, created_at and updated_at attributes aren't present in the PostgreSQL schema ? That would certainly be better to make sure that results can be compared apples to apples.

Looks great though ! 👍

@bmarkons

This comment has been minimized.

Copy link
Collaborator

bmarkons commented May 30, 2017

Nice catch! I omitted created_at and updated_at by mistake.

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.

@robin850

This comment has been minimized.

Copy link
Member

robin850 commented May 30, 2017

Yeah, you're right Marko ! That looks great then !

@bmarkons bmarkons force-pushed the bmarkons:add-bm-raw-scope-all branch from 5551242 to 47d07a1 Jul 10, 2017

@bmarkons bmarkons force-pushed the bmarkons:add-bm-raw-scope-all branch from 47d07a1 to 3113716 Jul 10, 2017

@bmarkons

This comment has been minimized.

Copy link
Collaborator

bmarkons commented Jul 10, 2017

@tgxworld
Do we want setup on RubyBench for pg and mysql gems same as for ActiveRecord and Sequel?
If yes, I think this one can be merged so I can continue with adding other benchmarks..

The next step would be to make and push docker image for pg suite.

@bmarkons bmarkons merged commit 4e62098 into ruby-bench:master Jul 26, 2017

@bmarkons bmarkons deleted the bmarkons:add-bm-raw-scope-all branch Jul 26, 2017

@tgxworld

This comment has been minimized.

Copy link
Member

tgxworld commented Jul 27, 2017

@bmarkons Sorry for missing this. I guess we should enable this since the benchmarks have been added :)

@bmarkons

This comment has been minimized.

Copy link
Collaborator

bmarkons commented Jul 27, 2017

Sure, I am writing driver for pg suite right now and Dockerfile.. :)

@bmarkons bmarkons added the gsoc2017 label Aug 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment