Skip to content
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

1.3.0 version slow on Windows #416

Closed
jirubio opened this issue Jan 21, 2022 · 3 comments · Fixed by #417
Closed

1.3.0 version slow on Windows #416

jirubio opened this issue Jan 21, 2022 · 3 comments · Fixed by #417

Comments

@jirubio
Copy link

jirubio commented Jan 21, 2022

This is my environment:
Rails 6.1.4.4
Ruby 2.7.4
PostgreSQL 12.6
OS Windows 10

PG gem 1.2.3 is working fine for me, but it does not support ruby 3. So I upgraded to the latest version 1.3.0.rc3. It installed without complaints and the rails app runs ok. I noticed some slowness so I compared 1.2.3 against 1.3.0 and the latter is really slow.
For our main page which does nothing rare, standard selects it went from 120ms to 600ms, same results for other pages. This is a 5x performance hit. Maybe 1.3.0 is not yet optimized for windows.
This is currently blocking our upgrade to ruby 3.

@larskanis
Copy link
Collaborator

I can confirm this slow down. pg-1.3.0-rc3 is slower by a factor of 5 to 10 than pg-1.2.3 on Windows.

I guess it's due to #397 , which changed quite a lot in the socket handling code. Now the Windows socket code is no longer a separate path, but is equal to the Posix code. Both are using the same ruby functions for READ/WRITE event notifications on the network socket. This is rb_io_wait() on ruby-3.0+ and rb_wait_for_single_fd() on ruby-2.x. So it looks like these ruby functions are much slower than the previous rb_w32_wait_events().

larskanis added a commit to larskanis/ruby-pg that referenced this issue Jan 21, 2022
It is based on the code that was removed in commit
ged@6c885e8

Fixes ged#416
larskanis added a commit to larskanis/ruby-pg that referenced this issue Jan 21, 2022
It is based on the code that was removed in commit
ged@6c885e8

Fixes ged#416
larskanis added a commit to larskanis/ruby-pg that referenced this issue Jan 21, 2022
It is based on the code that was removed in commit
ged@6c885e8

Fixes ged#416
larskanis added a commit to larskanis/ruby-pg that referenced this issue Jan 21, 2022
It is based on the code that was removed in commit
ged@6c885e8

Fixes ged#416
larskanis added a commit to larskanis/ruby-pg that referenced this issue Jan 21, 2022
It is based on the code that was removed in commit
ged@6c885e8

Fixes ged#416
@larskanis
Copy link
Collaborator

I pushed a new pre-release pg-1.3.0.rc4, which should fix this performance issue.

@jirubio
Copy link
Author

jirubio commented Jan 25, 2022

That was fast! Performance issue seems to be fixed, thanks Lars.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants