https://redmine.ruby-lang.org/
https://redmine.ruby-lang.org/favicon.ico?1711330511
2013-03-01T07:25:58Z
Ruby Issue Tracking System
Ruby master - Bug #7968: Poor UDPSocket#send performance in ruby 2.0.0 on windows
https://redmine.ruby-lang.org/issues/7968?journal_id=37203
2013-03-01T07:25:58Z
drbrain (Eric Hodel)
drbrain@segment7.net
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>This issue was solved with changeset r39542.<br>
Alan, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<ul>
<li>
<p>lib/rubygems/ext/builder.rb: Fix incompatibilities when installing<br>
extensions. Patch by Nobu.<br>
[ruby-trunk - Bug <a class="issue tracker-1 status-2 priority-4 priority-default" title="Bug: Poor UDPSocket#send performance in ruby 2.0.0 on windows (Assigned)" href="https://redmine.ruby-lang.org/issues/7968">#7968</a>] [ruby-trunk - Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: bson_ext doesn't install correctly in Ruby 2.0.0-p0 (Closed)" href="https://redmine.ruby-lang.org/issues/7971">#7971</a>]</p>
</li>
<li>
<p>lib/rubygems/ext/ext_conf_builder.rb: ditto.</p>
</li>
<li>
<p>lib/rubygems/installer.rb: ditto.</p>
</li>
<li>
<p>test/rubygems/test_gem_ext_ext_conf_builder.rb: Test for the above.</p>
</li>
<li>
<p>test/rubygems/test_gem_installer.rb: ditto.</p>
</li>
<li>
<p>lib/rubygems/commands/sources_command.rb: Prefer HTTPS over HTTP.</p>
</li>
<li>
<p>lib/rubygems/defaults.rb: ditto</p>
</li>
<li>
<p>lib/rubygems/dependency_resolver.rb: Ditto.</p>
</li>
<li>
<p>lib/rubygems/source.rb: ditto.</p>
</li>
<li>
<p>lib/rubygems/spec_fetcher.rb: ditto.</p>
</li>
<li>
<p>lib/rubygems/specification.rb: ditto.</p>
</li>
<li>
<p>lib/rubygems/test_utilities.rb: ditto.</p>
</li>
<li>
<p>test/rubygems/test_gem.rb: Test for the above.</p>
</li>
<li>
<p>test/rubygems/test_gem_commands_sources_command.rb: ditto.</p>
</li>
<li>
<p>test/rubygems/test_gem_dependency_resolver_api_set.rb: ditto.</p>
</li>
<li>
<p>test/rubygems/test_gem_remote_fetcher.rb: ditto.</p>
</li>
<li>
<p>test/rubygems/test_gem_source.rb: ditto.</p>
</li>
<li>
<p>test/rubygems/test_gem_spec_fetcher.rb: ditto.</p>
</li>
</ul>
Ruby master - Bug #7968: Poor UDPSocket#send performance in ruby 2.0.0 on windows
https://redmine.ruby-lang.org/issues/7968?journal_id=37227
2013-03-02T00:43:23Z
nagachika (Tomoyuki Chikanaga)
nagachika00@gmail.com
<ul><li><strong>% Done</strong> changed from <i>100</i> to <i>0</i></li><li><strong>Status</strong> changed from <i>Closed</i> to <i>Open</i></li></ul>
Ruby master - Bug #7968: Poor UDPSocket#send performance in ruby 2.0.0 on windows
https://redmine.ruby-lang.org/issues/7968?journal_id=37309
2013-03-06T02:02:32Z
cs96and (Alan Davies)
alan.n.davies@gmail.com
<ul></ul><p>I see the %Done went up to 100 and back down to zero. Is this fixed or not now?</p>
<p>Thanks<br>
Alan.</p>
Ruby master - Bug #7968: Poor UDPSocket#send performance in ruby 2.0.0 on windows
https://redmine.ruby-lang.org/issues/7968?journal_id=37310
2013-03-06T02:21:36Z
nagachika (Tomoyuki Chikanaga)
nagachika00@gmail.com
<ul></ul><p>Hello, Alan.</p>
<p>I re-open this ticket because it was accidentally closed by wrong commit message.<br>
This issue is not fixed yet.</p>
<p>BTW, in socketsendtest.rb UDPSocket#bind and #connect receive different port number. Is it right?<br>
On my environment, I've got an exception.</p>
<p>socketsendtest.rb:9:in `send': Connection refused - send(2) (Errno::ECONNREFUSED)</p>
<p>Thanks</p>
Ruby master - Bug #7968: Poor UDPSocket#send performance in ruby 2.0.0 on windows
https://redmine.ruby-lang.org/issues/7968?journal_id=37444
2013-03-10T03:40:20Z
cs96and (Alan Davies)
alan.n.davies@gmail.com
<ul></ul><p>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.</p>
Ruby master - Bug #7968: Poor UDPSocket#send performance in ruby 2.0.0 on windows
https://redmine.ruby-lang.org/issues/7968?journal_id=40275
2013-07-03T23:41:49Z
cs96and (Alan Davies)
alan.n.davies@gmail.com
<ul></ul><p>Any update on this?</p>
<p>Thanks<br>
Alan</p>
Ruby master - Bug #7968: Poor UDPSocket#send performance in ruby 2.0.0 on windows
https://redmine.ruby-lang.org/issues/7968?journal_id=40351
2013-07-08T09:58:21Z
luislavena (Luis Lavena)
luislavena@gmail.com
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> changed from <i>windows</i> to <i>usa (Usaku NAKAMURA)</i></li></ul><p>Any suggestion about this?</p>
Ruby master - Bug #7968: Poor UDPSocket#send performance in ruby 2.0.0 on windows
https://redmine.ruby-lang.org/issues/7968?journal_id=44343
2014-01-15T14:49:15Z
cs96and (Alan Davies)
alan.n.davies@gmail.com
<ul></ul><p>This is still a problem in 2.0.0-p353 on windows. Is there any update?</p>
<p>Thanks<br>
Alan.</p>
Ruby master - Bug #7968: Poor UDPSocket#send performance in ruby 2.0.0 on windows
https://redmine.ruby-lang.org/issues/7968?journal_id=44344
2014-01-15T14:55:53Z
cs96and (Alan Davies)
alan.n.davies@gmail.com
<ul></ul><p>Issue <a class="issue tracker-1 status-2 priority-4 priority-default" title="Bug: Poor UDPSocket#send performance in ruby 2.0.0 on windows (Assigned)" href="https://redmine.ruby-lang.org/issues/7968">#7968</a> has been updated by Alan Davies.</p>
<p>This is still a problem in 2.0.0-p353 on windows. Is there any update?</p>
<p>Thanks<br>
Alan.</p>
<hr>
<p>Bug <a class="issue tracker-1 status-2 priority-4 priority-default" title="Bug: Poor UDPSocket#send performance in ruby 2.0.0 on windows (Assigned)" href="https://redmine.ruby-lang.org/issues/7968">#7968</a>: Poor UDPSocket#send performance in ruby 2.0.0 on windows<br>
<a href="https://bugs.ruby-lang.org/issues/7968#change-44343" class="external">https://bugs.ruby-lang.org/issues/7968#change-44343</a></p>
<ul>
<li>Author: Alan Davies</li>
<li>Status: Assigned</li>
<li>Priority: Normal</li>
<li>Assignee: Usaku NAKAMURA</li>
<li>Category: platform/windows</li>
<li>Target version:</li>
<li>ruby -v: ruby 2.0.0p0 (2013-02-24) [x64-mingw32]</li>
<li>Backport:</li>
</ul>
<hr>
<p>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...</p>
<p>d:\scripts>bash -c "ruby --version"<br>
ruby 2.0.0p0 (2013-02-24) [x64-mingw32]</p>
<p>d:\scripts>bash -c "time ruby socketsendtest.rb"</p>
<p>real 0m2.572s<br>
user 0m0.000s<br>
sys 0m0.016s</p>
<p>However, running the same test with 1.9.3 is much faster...</p>
<p>d:\scripts>pik 193</p>
<p>d:\scripts>bash -c "ruby --version"<br>
ruby 1.9.3p374 (2013-01-15) [i386-mingw32]</p>
<p>d:\scripts>bash -c "time ruby socketsendtest.rb"</p>
<p>real 0m0.993s<br>
user 0m0.015s<br>
sys 0m0.016s</p>
<p>Additionally, if I change the send call to a print (commented out in the script), then the performance is fine on 2.0.0....</p>
<p>d:\scripts>pik 200</p>
<p>d:\scripts>bash -c "ruby --version"<br>
ruby 2.0.0p0 (2013-02-24) [x64-mingw32]</p>
<p>d:\scripts>bash -c "time ruby socketsendtest.rb"</p>
<p>real 0m0.907s<br>
user 0m0.000s<br>
sys 0m0.015s</p>
<p>What is send() doing that print() doesn't do that is causing the massive performance drop?</p>
<p>Thanks<br>
Alan.</p>
<p>---Files--------------------------------<br>
socketsendtest.rb (266 Bytes)</p>
<p>--<br>
<a href="http://bugs.ruby-lang.org/" class="external">http://bugs.ruby-lang.org/</a></p>
Ruby master - Bug #7968: Poor UDPSocket#send performance in ruby 2.0.0 on windows
https://redmine.ruby-lang.org/issues/7968?journal_id=67475
2017-10-21T16:18:55Z
usa (Usaku NAKAMURA)
usa@garbagecollect.jp
<ul><li><strong>Assignee</strong> changed from <i>usa (Usaku NAKAMURA)</i> to <i>windows</i></li></ul>
Ruby master - Bug #7968: Poor UDPSocket#send performance in ruby 2.0.0 on windows
https://redmine.ruby-lang.org/issues/7968?journal_id=67529
2017-10-23T00:23:19Z
MSP-Greg (Greg L)
<ul></ul><p>I ran this up on Appveyor using all minor versions 1.9.3 thru trunk. The code loop is one of two:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="mi">100000</span><span class="p">.</span><span class="nf">times</span> <span class="p">{</span> <span class="n">s</span><span class="p">.</span><span class="nf">send</span><span class="p">(</span><span class="n">str</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="p">}</span>
</code></pre>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="mi">100000</span><span class="p">.</span><span class="nf">times</span> <span class="p">{</span> <span class="n">s</span><span class="p">.</span><span class="nf">print</span><span class="p">(</span><span class="n">str</span><span class="p">)</span> <span class="p">}</span>
</code></pre>
<p>One set was run with str.length = 10, the other with str.length = 2000. String length didn't really affect test times...</p>
<p>When using <code>send</code>, 1.9.3 is fastest, 2.0.0 is slowest, others were in between. When using <code>print</code>, 1.9.3 thru 2.1.9 are faster by approx 2x compared to 2.2.6 thru trunk.</p>
<p>Anyway, not that well versed in all the uses of sockets, so I can't judge whether these time differences are 'real world' significant. Also, not a terribly scientific test...</p>
<pre><code> 10 Characters Send
0.56247 ruby 1.9.3p551 (2014-11-13) [i386-mingw32]
1.70312 ruby 2.0.0p648 (2015-12-16) [x64-mingw32]
1.00000 ruby 2.1.9p490 (2016-03-30 revision 54437) [x64-mingw32]
0.98534 ruby 2.2.6p396 (2016-11-15 revision 56800) [x64-mingw32]
0.93747 ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]
0.95312 ruby 2.4.1p111 (2017-03-22 revision 58053) [x64-mingw32]
0.90446 ruby 2.5.0dev (2017-10-23 trunk 60368) [x64-mingw32]
10 Characters Print
0.59375 ruby 1.9.3p551 (2014-11-13) [i386-mingw32]
0.46878 ruby 2.0.0p648 (2015-12-16) [x64-mingw32]
0.48440 ruby 2.1.9p490 (2016-03-30 revision 54437) [x64-mingw32]
1.01562 ruby 2.2.6p396 (2016-11-15 revision 56800) [x64-mingw32]
0.98440 ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]
1.01565 ruby 2.4.1p111 (2017-03-22 revision 58053) [x64-mingw32]
0.98707 ruby 2.5.0dev (2017-10-23 trunk 60368) [x64-mingw32]
2000 Characters Send
0.56253 ruby 1.9.3p551 (2014-11-13) [i386-mingw32]
1.75003 ruby 2.0.0p648 (2015-12-16) [x64-mingw32]
1.03125 ruby 2.1.9p490 (2016-03-30 revision 54437) [x64-mingw32]
1.01565 ruby 2.2.6p396 (2016-11-15 revision 56800) [x64-mingw32]
1.03124 ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]
1.00002 ruby 2.4.1p111 (2017-03-22 revision 58053) [x64-mingw32]
0.95394 ruby 2.5.0dev (2017-10-23 trunk 60368) [x64-mingw32]
2000 Characters Print
0.60941 ruby 1.9.3p551 (2014-11-13) [i386-mingw32]
0.50001 ruby 2.0.0p648 (2015-12-16) [x64-mingw32]
0.51566 ruby 2.1.9p490 (2016-03-30 revision 54437) [x64-mingw32]
1.03125 ruby 2.2.6p396 (2016-11-15 revision 56800) [x64-mingw32]
1.01562 ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]
1.04689 ruby 2.4.1p111 (2017-03-22 revision 58053) [x64-mingw32]
1.00382 ruby 2.5.0dev (2017-10-23 trunk 60368) [x64-mingw32]
</code></pre>
Ruby master - Bug #7968: Poor UDPSocket#send performance in ruby 2.0.0 on windows
https://redmine.ruby-lang.org/issues/7968?journal_id=105296
2023-11-13T19:10:22Z
JesseJohnson (Jesse Johnson)
<ul></ul><p>Can anyone replicate this on Ruby 3 or later?</p>
Ruby master - Bug #7968: Poor UDPSocket#send performance in ruby 2.0.0 on windows
https://redmine.ruby-lang.org/issues/7968?journal_id=105336
2023-11-15T19:25:25Z
cs96and (Alan Davies)
alan.n.davies@gmail.com
<ul></ul><p>JesseJohnson (Jesse Johnson) wrote in <a href="#note-12">#note-12</a>:</p>
<blockquote>
<p>Can anyone replicate this on Ruby 3 or later?</p>
</blockquote>
<p>Still poor performance in 3.1.3 and 3.2.2...</p>
<p><strong>1.9.3 send()</strong></p>
<pre><code>$ ./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
</code></pre>
<p><strong>1.9.3 print()</strong></p>
<pre><code>$ time ./ruby-1.9.3-p551-i386-mingw32/bin/ruby.exe d:/socketsendtest.rb
real 0m1.108s
user 0m0.000s
sys 0m0.000s
</code></pre>
<p><strong>3.1.3 send()</strong></p>
<pre><code>$ /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
</code></pre>
<p><strong>3.1.3 print()</strong></p>
<pre><code>$ time /c/tools/ruby31/bin/ruby d:/socketsendtest.rb
real 0m1.273s
user 0m0.000s
sys 0m0.015s
</code></pre>
<p><strong>3.2.2 send()</strong></p>
<pre><code>$ ./rubyinstaller-3.2.2-1-x64/bin/ruby.exe --version
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt]
$ time ./rubyinstaller-3.2.2-1-x64/bin/ruby.exe d:/socketsendtest.rb
real 0m2.044s
user 0m0.000s
sys 0m0.000s
</code></pre>
<p><strong>3.2.2 print()</strong></p>
<pre><code>$ time ./rubyinstaller-3.2.2-1-x64/bin/ruby.exe d:/socketsendtest.rb
real 0m1.338s
user 0m0.000s
sys 0m0.000s
</code></pre>
Ruby master - Bug #7968: Poor UDPSocket#send performance in ruby 2.0.0 on windows
https://redmine.ruby-lang.org/issues/7968?journal_id=105338
2023-11-16T01:51:46Z
k0kubun (Takashi Kokubun)
takashikkbn@gmail.com
<ul></ul><p>Just in case, could you measure the time spent on the loop instead of a whole Ruby command? The prelude script sometimes takes a lot of time, the performance varies across different versions, and <code>time</code> command would benchmark that as well. You can just call <code>Time.new</code> before and after the loop, subtract them, and report the result for each version.</p>
Ruby master - Bug #7968: Poor UDPSocket#send performance in ruby 2.0.0 on windows
https://redmine.ruby-lang.org/issues/7968?journal_id=105341
2023-11-16T13:24:33Z
cs96and (Alan Davies)
alan.n.davies@gmail.com
<ul></ul><p>k0kubun (Takashi Kokubun) wrote in <a href="#note-14">#note-14</a>:</p>
<blockquote>
<p>Just in case, could you measure the time spent on the loop instead of a whole Ruby command? The prelude script sometimes takes a lot of time, the performance varies across different versions, and <code>time</code> command would benchmark that as well. You can just call <code>Time.new</code> before and after the loop, subtract them, and report the result for each version.</p>
</blockquote>
<p>I also increased the loop by a factor of 10 (to 1,000,000) so it runs for longer. Times are in seconds...</p>
<p><strong>1.9.3 send:</strong></p>
<pre><code>ruby-1.9.3\bin\ruby.exe socketsendtest.rb
10.495193
</code></pre>
<p><strong>1.9.3 print:</strong></p>
<pre><code>ruby-1.9.3\bin\ruby.exe socketsendtest.rb
10.384035
</code></pre>
<p><strong>3.2.2 send</strong></p>
<pre><code>ruby-3.2.2\bin\ruby.exe socketsendtest.rb
17.3447397
</code></pre>
<p><strong>3.2.2 print</strong></p>
<pre><code>ruby-3.2.2\bin\ruby.exe socketsendtest.rb
9.8053804
</code></pre>
<p>Out of interest I ran the code through the profile module as well...</p>
<p><strong>1.9.3 send</strong></p>
<pre><code>ruby-1.9.3\bin\ruby.exe -rprofile socketsendtest.rb
19.520433
% cumulative self self total
time seconds seconds calls ms/call ms/call name
56.95 6.03 6.03 1000000 0.01 0.01 UDPSocket#send
43.05 10.59 4.56 1 4561.00 10594.00 Integer#times
0.00 10.59 0.00 1 0.00 0.00 UDPSocket#bind
0.00 10.59 0.00 10 0.00 0.00 Class#inherited
0.00 10.59 0.00 40 0.00 0.00 BasicObject#singleton_method_added
0.00 10.59 0.00 104 0.00 0.00 Module#method_added
0.00 10.59 0.00 2 0.00 0.00 Kernel.gem_original_require
0.00 10.59 0.00 2 0.00 0.00 Kernel.require
0.00 10.59 0.00 4 0.00 0.00 Module#private
0.00 10.59 0.00 2 0.00 0.00 Module#attr_reader
0.00 10.59 0.00 1 0.00 0.00 UDPSocket#initialize
0.00 10.59 0.00 1 0.00 0.00 IO#new
0.00 10.59 0.00 2 0.00 0.00 Hash#empty?
0.00 10.59 0.00 1 0.00 0.00 UDPSocket#connect
0.00 10.59 0.00 2 0.00 0.00 Time#initialize
0.00 10.59 0.00 2 0.00 0.00 Class#new
0.00 10.59 0.00 4 0.00 0.00 IO#set_encoding
0.00 10.59 0.00 2 0.00 0.00 Gem.unresolved_deps
0.00 10.59 0.00 1 0.00 0.00 Float#/
0.00 10.59 0.00 1 0.00 0.00 Float#quo
0.00 10.59 0.00 1 0.00 0.00 Time#-
0.00 10.59 0.00 1 0.00 0.00 Float#to_s
0.00 10.59 0.00 2 0.00 0.00 IO#write
0.00 10.59 0.00 1 0.00 0.00 IO#puts
0.00 10.59 0.00 1 0.00 0.00 Kernel.puts
0.00 10.59 0.00 1 0.00 10594.00 #toplevel
</code></pre>
<p><strong>1.9.3 print</strong></p>
<pre><code>ruby-1.9.3\bin\ruby.exe -rprofile socketsendtest.rb
25.818462
% cumulative self self total
time seconds seconds calls ms/call ms/call name
38.19 6.18 6.18 1000000 0.01 0.01 IO#print
33.27 11.56 5.38 1000002 0.01 0.01 IO#write
28.45 16.16 4.60 1 4600.00 16156.00 Integer#times
0.09 16.17 0.01 2 7.50 15.00 Kernel.require
0.00 16.17 0.00 1 0.00 0.00 UDPSocket#bind
0.00 16.17 0.00 104 0.00 0.00 Module#method_added
0.00 16.17 0.00 2 0.00 7.50 Kernel.gem_original_require
0.00 16.17 0.00 4 0.00 0.00 IO#set_encoding
0.00 16.17 0.00 4 0.00 0.00 Module#private
0.00 16.17 0.00 2 0.00 0.00 Module#attr_reader
0.00 16.17 0.00 1 0.00 0.00 UDPSocket#initialize
0.00 16.17 0.00 1 0.00 0.00 IO#new
0.00 16.17 0.00 40 0.00 0.00 BasicObject#singleton_method_added
0.00 16.17 0.00 1 0.00 0.00 UDPSocket#connect
0.00 16.17 0.00 2 0.00 0.00 Time#initialize
0.00 16.17 0.00 2 0.00 0.00 Class#new
0.00 16.17 0.00 10 0.00 0.00 Class#inherited
0.00 16.17 0.00 2 0.00 0.00 Hash#empty?
0.00 16.17 0.00 2 0.00 0.00 Gem.unresolved_deps
0.00 16.17 0.00 1 0.00 0.00 Float#/
0.00 16.17 0.00 1 0.00 0.00 Float#quo
0.00 16.17 0.00 1 0.00 0.00 Time#-
0.00 16.17 0.00 1 0.00 0.00 Float#to_s
0.00 16.17 0.00 1 0.00 0.00 IO#puts
0.00 16.17 0.00 1 0.00 0.00 Kernel.puts
0.00 16.17 0.00 1 0.00 16171.00 #toplevel
</code></pre>
<p><strong>3.2.2 send</strong></p>
<pre><code>ruby-3.2.2\bin\ruby.exe -rprofile socketsendtest.rb
32.9209883
% cumulative self self total
time seconds seconds calls ms/call ms/call name
39.03 7.72 7.72 1000000 0.01 0.02 nil#
38.17 15.27 7.55 1000000 0.01 0.01 UDPSocket#send
22.72 19.77 4.50 1 4495.00 19766.00 Integer#times
0.08 19.78 0.02 4 4.00 16.00 Kernel#require
0.00 19.78 0.00 2 0.00 0.00 Kernel#respond_to?
0.00 19.78 0.00 2 0.00 0.00 Hash#[]
0.00 19.78 0.00 2 0.00 0.00 Gem.find_unresolved_default_spec
0.00 19.78 0.00 2 0.00 0.00 Gem::Specification.unresolved_deps
0.00 19.78 0.00 2 0.00 0.00 Hash#empty?
0.00 19.78 0.00 2 0.00 0.00 Monitor#exit
0.00 19.78 0.00 378 0.00 0.00 Module#const_added
0.00 19.78 0.00 13 0.00 0.00 Class#inherited
0.00 19.78 0.00 50 0.00 0.00 BasicObject#singleton_method_added
0.00 19.78 0.00 141 0.00 0.00 Module#method_added
0.00 19.78 0.00 2 0.00 0.00 Monitor#enter
0.00 19.78 0.00 1 0.00 0.00 Module#method_defined?
0.00 19.78 0.00 1 0.00 0.00 Module#protected
0.00 19.78 0.00 1 0.00 0.00 String#=~
0.00 19.78 0.00 3 0.00 0.00 Module#private
0.00 19.78 0.00 2 0.00 0.00 Module#attr_reader
0.00 19.78 0.00 1 0.00 0.00 UDPSocket#initialize
0.00 19.78 0.00 1 0.00 0.00 IO.new
0.00 19.78 0.00 1 0.00 0.00 UDPSocket#bind
0.00 19.78 0.00 1 0.00 0.00 UDPSocket#connect
0.00 19.78 0.00 2 0.00 0.00 Time#initialize
0.00 19.78 0.00 2 0.00 0.00 Class#new
0.00 19.78 0.00 2 0.00 0.00 Gem.discover_gems_on_require
0.00 19.78 0.00 4 0.00 0.00 IO#set_encoding
0.00 19.78 0.00 1 0.00 0.00 TracePoint#enable
0.00 19.78 0.00 1 0.00 0.00 Float#/
0.00 19.78 0.00 1 0.00 0.00 Float#fdiv
0.00 19.78 0.00 1 0.00 0.00 Time#-
0.00 19.78 0.00 1 0.00 0.00 Float#to_s
0.00 19.78 0.00 1 0.00 0.00 IO#write
0.00 19.78 0.00 1 0.00 0.00 IO#puts
0.00 19.78 0.00 1 0.00 0.00 Kernel#puts
0.00 19.78 0.00 1 0.00 0.00 TracePoint#disable
0.00 19.78 0.00 1 0.00 19782.00 #toplevel
</code></pre>
<p><strong>3.2.2 print</strong></p>
<pre><code>ruby-3.2.2\bin\ruby.exe -rprofile socketsendtest.rb
29.3270973
% cumulative self self total
time seconds seconds calls ms/call ms/call name
33.07 6.50 6.50 1000000 0.01 0.01 IO#print
27.12 11.84 5.34 1000000 0.01 0.02 nil#
21.52 16.08 4.23 1 4234.00 19672.00 Integer#times
18.28 19.67 3.60 1000001 0.00 0.00 IO#write
0.00 19.67 0.00 2 0.00 0.00 Kernel#respond_to?
0.00 19.67 0.00 2 0.00 0.00 Hash#[]
0.00 19.67 0.00 2 0.00 0.00 Gem.find_unresolved_default_spec
0.00 19.67 0.00 2 0.00 0.00 Gem::Specification.unresolved_deps
0.00 19.67 0.00 2 0.00 0.00 Hash#empty?
0.00 19.67 0.00 2 0.00 0.00 Monitor#exit
0.00 19.67 0.00 378 0.00 0.00 Module#const_added
0.00 19.67 0.00 13 0.00 0.00 Class#inherited
0.00 19.67 0.00 50 0.00 0.00 BasicObject#singleton_method_added
0.00 19.67 0.00 141 0.00 0.00 Module#method_added
0.00 19.67 0.00 2 0.00 0.00 Gem.discover_gems_on_require
0.00 19.67 0.00 1 0.00 0.00 Module#method_defined?
0.00 19.67 0.00 1 0.00 0.00 Module#protected
0.00 19.67 0.00 1 0.00 0.00 String#=~
0.00 19.67 0.00 3 0.00 0.00 Module#private
0.00 19.67 0.00 2 0.00 0.00 Module#attr_reader
0.00 19.67 0.00 1 0.00 0.00 UDPSocket#initialize
0.00 19.67 0.00 1 0.00 0.00 IO.new
0.00 19.67 0.00 1 0.00 0.00 UDPSocket#bind
0.00 19.67 0.00 1 0.00 0.00 UDPSocket#connect
0.00 19.67 0.00 2 0.00 0.00 Time#initialize
0.00 19.67 0.00 2 0.00 0.00 Class#new
0.00 19.67 0.00 2 0.00 0.00 Monitor#enter
0.00 19.67 0.00 4 0.00 0.00 IO#set_encoding
0.00 19.67 0.00 4 0.00 0.00 Kernel#require
0.00 19.67 0.00 1 0.00 0.00 TracePoint#enable
0.00 19.67 0.00 1 0.00 0.00 Float#/
0.00 19.67 0.00 1 0.00 0.00 Float#fdiv
0.00 19.67 0.00 1 0.00 0.00 Time#-
0.00 19.67 0.00 1 0.00 0.00 Float#to_s
0.00 19.67 0.00 1 0.00 0.00 IO#puts
0.00 19.67 0.00 1 0.00 0.00 Kernel#puts
0.00 19.67 0.00 1 0.00 0.00 TracePoint#disable
0.00 19.67 0.00 1 0.00 19672.00 #toplevel
</code></pre>
<p>3.2.2 seems to be spending a fair amount of time in a function called <code>nil#</code>. Though the 3.2.2 print() version does as well, but doesn't suffer the slowdown.</p>