Issue #7968 has been updated by MSP-Greg (Greg L).


I ran this up on Appveyor using all minor versions 1.9.3 thru trunk.  The code loop is one of two:

```ruby
100000.times { s.send(str, 0) }
```

```ruby
100000.times { s.print(str) }
```

One set was run with str.length = 10, the other with str.length = 2000.  String length didn't really affect test times...

When using `send`, 1.9.3 is fastest, 2.0.0 is slowest, others were in between.  When using `print`, 1.9.3 thru 2.1.9 are faster by approx 2x compared to 2.2.6 thru trunk.

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...

```
  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]
```


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

* Author: cs96and (Alan Davies)
* Status: Assigned
* Priority: Normal
* Assignee: cruby-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)


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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>