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

improve method IoLoopBody#tick #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

improve method IoLoopBody#tick #49

wants to merge 1 commit into from

Conversation

ilyario
Copy link

@ilyario ilyario commented Oct 18, 2017

We profiled our apps that use the cql-rb and cequel. The result revealed that the major slowdown happens in the Ione::Io::IoLoopBody#tick. This method slightly improves speed.

@iconara
Copy link
Owner

iconara commented Oct 18, 2017

Thank you for this.

There seems to be a lot of unrelated changes making it hard to figure out what is actually the improvement. Could you please remove the changes that are just aesthetics? (I'm thinking of the changes from block-form if to trailing if, for example)

I think that the only change you've introduced is moving connecting.each { |s| s.connect } to the loop above, but I might be missing something in the diff. It would be much easier for me to review this if you submitted only the functional change.

However, if that is the only change I'm not sure what it is that makes a difference.

@sockets.each do |s|
  s.connect if s.connecting?
end

and

connecting.each { |s| s.connect }

don't really look like they could have very different performance characteristics. Is it creating the extra array? What exactly is making it faster?

What kind of performance difference are you seeing? On what Ruby versions?

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 this pull request may close these issues.

2 participants