Bug #7968

Poor UDPSocket#send performance in ruby 2.0.0 on windows

Added by Alan Davies about 1 year ago. Updated 3 months ago.

[ruby-core:52936]
Status:Assigned
Priority:Normal
Assignee:Usaku NAKAMURA
Category:platform/windows
Target version:-
ruby -v:ruby 2.0.0p0 (2013-02-24) [x64-mingw32] Backport:

Description

I have noticed that the performance of UDPSocket#send on ruby 2.0.0 on windows is much poorer than that of 1.9.3 or 1.8.7. Running the attahced script on 2.0.0 gives the following...

d:\scripts>bash -c "ruby --version"
ruby 2.0.0p0 (2013-02-24) [x64-mingw32]

d:\scripts>bash -c "time ruby socketsendtest.rb"

real 0m2.572s
user 0m0.000s
sys 0m0.016s

However, running the same test with 1.9.3 is much faster...

d:\scripts>pik 193

d:\scripts>bash -c "ruby --version"
ruby 1.9.3p374 (2013-01-15) [i386-mingw32]

d:\scripts>bash -c "time ruby socketsendtest.rb"

real 0m0.993s
user 0m0.015s
sys 0m0.016s

Additionally, if I change the send call to a print (commented out in the script), then the performance is fine on 2.0.0....

d:\scripts>pik 200

d:\scripts>bash -c "ruby --version"
ruby 2.0.0p0 (2013-02-24) [x64-mingw32]

d:\scripts>bash -c "time ruby socketsendtest.rb"

real 0m0.907s
user 0m0.000s
sys 0m0.015s

What is send() doing that print() doesn't do that is causing the massive performance drop?

Thanks
Alan.

socketsendtest.rb Magnifier - Script to test UDPSocket#send (266 Bytes) Alan Davies, 02/26/2013 08:55 PM

Associated revisions

Revision 39542
Added by Eric Hodel about 1 year ago

  • lib/rubygems/ext/builder.rb: Fix incompatibilities when installing extensions. Patch by Nobu. [ruby-trunk - Bug #7968] [ruby-trunk - Bug #7971]
  • lib/rubygems/ext/extconfbuilder.rb: ditto.
  • lib/rubygems/installer.rb: ditto.
  • test/rubygems/testgemextextconf_builder.rb: Test for the above.
  • test/rubygems/testgeminstaller.rb: ditto.

  • lib/rubygems/commands/sources_command.rb: Prefer HTTPS over HTTP.

  • lib/rubygems/defaults.rb: ditto

  • lib/rubygems/dependency_resolver.rb: Ditto.

  • lib/rubygems/source.rb: ditto.

  • lib/rubygems/spec_fetcher.rb: ditto.

  • lib/rubygems/specification.rb: ditto.

  • lib/rubygems/test_utilities.rb: ditto.

  • test/rubygems/test_gem.rb: Test for the above.

  • test/rubygems/testgemcommandssourcescommand.rb: ditto.

  • test/rubygems/testgemdependencyresolverapi_set.rb: ditto.

  • test/rubygems/testgemremote_fetcher.rb: ditto.

  • test/rubygems/testgemsource.rb: ditto.

  • test/rubygems/testgemspec_fetcher.rb: ditto.

History

#1 Updated by Eric Hodel about 1 year ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r39542.
Alan, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • lib/rubygems/ext/builder.rb: Fix incompatibilities when installing extensions. Patch by Nobu. [ruby-trunk - Bug #7968] [ruby-trunk - Bug #7971]
  • lib/rubygems/ext/extconfbuilder.rb: ditto.
  • lib/rubygems/installer.rb: ditto.
  • test/rubygems/testgemextextconf_builder.rb: Test for the above.
  • test/rubygems/testgeminstaller.rb: ditto.

  • lib/rubygems/commands/sources_command.rb: Prefer HTTPS over HTTP.

  • lib/rubygems/defaults.rb: ditto

  • lib/rubygems/dependency_resolver.rb: Ditto.

  • lib/rubygems/source.rb: ditto.

  • lib/rubygems/spec_fetcher.rb: ditto.

  • lib/rubygems/specification.rb: ditto.

  • lib/rubygems/test_utilities.rb: ditto.

  • test/rubygems/test_gem.rb: Test for the above.

  • test/rubygems/testgemcommandssourcescommand.rb: ditto.

  • test/rubygems/testgemdependencyresolverapi_set.rb: ditto.

  • test/rubygems/testgemremote_fetcher.rb: ditto.

  • test/rubygems/testgemsource.rb: ditto.

  • test/rubygems/testgemspec_fetcher.rb: ditto.

#2 Updated by Tomoyuki Chikanaga about 1 year ago

  • Status changed from Closed to Open
  • % Done changed from 100 to 0

#3 Updated by Alan Davies about 1 year ago

I see the %Done went up to 100 and back down to zero. Is this fixed or not now?

Thanks
Alan.

#4 Updated by Tomoyuki Chikanaga about 1 year ago

Hello, Alan.

I re-open this ticket because it was accidentally closed by wrong commit message.
This issue is not fixed yet.

BTW, in socketsendtest.rb UDPSocket#bind and #connect receive different port number. Is it right?
On my environment, I've got an exception.

socketsendtest.rb:9:in `send': Connection refused - send(2) (Errno::ECONNREFUSED)

Thanks

#5 Updated by Alan Davies about 1 year ago

The bind and connect can be different. The bind specifies what port you are sending from, and connect specifies the port you are sending to (the ip address can be a different box too). It runs fine for me with different ports, but you can make them the same if you want.

#6 Updated by Alan Davies 10 months ago

Any update on this?

Thanks
Alan

#7 Updated by Luis Lavena 9 months ago

  • Status changed from Open to Assigned
  • Assignee changed from cruby-windows to Usaku NAKAMURA

Any suggestion about this?

#8 Updated by Alan Davies 3 months ago

This is still a problem in 2.0.0-p353 on windows. Is there any update?

Thanks
Alan.

#9 Updated by Alan Davies 3 months ago

Issue #7968 has been updated by Alan Davies.

This is still a problem in 2.0.0-p353 on windows. Is there any update?

Thanks
Alan.


Bug #7968: Poor UDPSocket#send performance in ruby 2.0.0 on windows
https://bugs.ruby-lang.org/issues/7968#change-44343

  • Author: Alan Davies
  • Status: Assigned
  • Priority: Normal
  • Assignee: Usaku NAKAMURA
  • Category: platform/windows
  • Target version:
  • ruby -v: ruby 2.0.0p0 (2013-02-24) [x64-mingw32]
  • Backport:

    I have noticed that the performance of UDPSocket#send on ruby 2.0.0 on windows is much poorer than that of 1.9.3 or 1.8.7. Running the attahced script on 2.0.0 gives the following...

    d:\scripts>bash -c "ruby --version"
    ruby 2.0.0p0 (2013-02-24) [x64-mingw32]

    d:\scripts>bash -c "time ruby socketsendtest.rb"

    real 0m2.572s
    user 0m0.000s
    sys 0m0.016s

    However, running the same test with 1.9.3 is much faster...

    d:\scripts>pik 193

    d:\scripts>bash -c "ruby --version"
    ruby 1.9.3p374 (2013-01-15) [i386-mingw32]

    d:\scripts>bash -c "time ruby socketsendtest.rb"

    real 0m0.993s
    user 0m0.015s
    sys 0m0.016s

    Additionally, if I change the send call to a print (commented out in the script), then the performance is fine on 2.0.0....

    d:\scripts>pik 200

    d:\scripts>bash -c "ruby --version"
    ruby 2.0.0p0 (2013-02-24) [x64-mingw32]

    d:\scripts>bash -c "time ruby socketsendtest.rb"

    real 0m0.907s
    user 0m0.000s
    sys 0m0.015s

    What is send() doing that print() doesn't do that is causing the massive performance drop?

    Thanks
    Alan.

    ---Files--------------------------------
    socketsendtest.rb (266 Bytes)

    http://bugs.ruby-lang.org/

Also available in: Atom PDF