From: "cs96and (Alan Davies) via ruby-core" Date: 2023-11-15T19:25:25+00:00 Subject: [ruby-core:115399] [Ruby master Bug#7968] Poor UDPSocket#send performance in ruby 2.0.0 on windows Issue #7968 has been updated by cs96and (Alan Davies). JesseJohnson (Jesse Johnson) wrote in #note-12: > Can anyone replicate this on Ruby 3 or later? Still poor performance in 3.1.3... **1.9.3 send()** ``` $ ./ruby-1.9.3-p551-i386-mingw32/bin/ruby.exe --version ruby 1.9.3p551 (2014-11-13) [i386-mingw32] $ time ./ruby-1.9.3-p551-i386-mingw32/bin/ruby.exe d:/socketsendtest.rb real 0m1.086s user 0m0.000s sys 0m0.000s ``` **1.9.3 print()** ``` $ time ./ruby-1.9.3-p551-i386-mingw32/bin/ruby.exe d:/socketsendtest.rb real 0m1.108s user 0m0.000s sys 0m0.000s ``` **3.1.3 send()** ``` $ /c/tools/ruby31/bin/ruby --version ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x64-mingw-ucrt] $ time /c/tools/ruby31/bin/ruby d:/socketsendtest.rb real 0m1.927s user 0m0.000s sys 0m0.015s ``` **3.1.3 print()** ``` $ time /c/tools/ruby31/bin/ruby d:/socketsendtest.rb real 0m1.273s user 0m0.000s sys 0m0.015s ``` I also tried 3.2.2, however it runs incredibly quickly, and looking in Wireshark, I cannot see it actually generating any traffic. ---------------------------------------- Bug #7968: Poor UDPSocket#send performance in ruby 2.0.0 on windows https://bugs.ruby-lang.org/issues/7968#change-105336 * Author: cs96and (Alan Davies) * Status: Assigned * Priority: Normal * Assignee: windows * ruby -v: ruby 2.0.0p0 (2013-02-24) [x64-mingw32] ---------------------------------------- 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) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/