1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/NEWS
normal c18df6d87c connect_nonblock supports "exception: false"
This is for consistency with accept_nonblock arguments and gives a
minor speedup from avoiding exceptions.
[ruby-core:68838] [Feature #11024]

* ext/openssl/ossl_ssl.c (ossl_ssl_connect_nonblock):
  support `exception: false'
* (get_no_exception): move function location
* ext/socket/socket.c (sock_connect_nonblock):
  support `exception: false'
* test/openssl/test_pair.rb (test_connect_accept_nonblock_no_exception):
  test `exception: false' on connect,
  rename from `test_accept_nonblock_no_exception'
* test/socket/test_nonblock.rb (test_connect_nonblock_no_exception):
  new test

Benchmark results:

default            0.050000   0.100000   0.150000 (  0.151307)
exception: false   0.030000   0.080000   0.110000 (  0.108840)

----------------------------8<-----------------------
require 'socket'
require 'benchmark'
require 'io/wait'
require 'tmpdir'

host = '127.0.0.1'
serv = TCPServer.new(host, 0) # UNIX sockets may not hit EINPROGRESS

nr = 5000 # few iterations to avoid running out of ports

addr = serv.getsockname
pid = fork do
  begin
    serv.accept.close
  rescue => e
    warn "#$$: #{e.message} (#{e.class})"
  end while true
end
at_exit { Process.kill(:TERM, pid) }
serv.close

Benchmark.bmbm do |x|
  x.report("default") do
    nr.times do
      s = Socket.new(:INET, :STREAM)
      s.setsockopt(:SOL_SOCKET, :SO_REUSEADDR, 1)
      begin
        s.connect_nonblock(addr)
      rescue IO::WaitWritable
        s.wait_writable
      end
      s.close
    end
  end
  x.report("exception: false") do
    nr.times do
      s = Socket.new(:INET, :STREAM)
      s.setsockopt(:SOL_SOCKET, :SO_REUSEADDR, 1)
      case s.connect_nonblock(addr, exception: false)
      when :wait_writable
        s.wait_writable
      end
      s.close
    end
  end
end

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-12 01:41:51 +00:00

77 lines
2.3 KiB
Text

# -*- rdoc -*-
= NEWS for Ruby 2.3.0
This document is a list of user visible feature changes made between
releases except for bug fixes.
Note that each entry is kept so brief that no reason behind or
reference information is supplied with. For a full list of changes
with all sufficient information, see the ChangeLog file.
== Changes since the 2.2.0 release
=== Language changes
=== Core classes updates (outstanding ones only)
=== Core classes compatibility issues (excluding feature bug fixes)
* Array
* Array#select!, Array#keep_if, Array#reject!, and Array#delete_if
no longer changes the receiver array instantly every time the
block is called. [Feature #10714]
* Array#flatten and Array#flatten! no longer try to call #to_ary
method on elements beyond the given level. [Bug #10748]
* Enumerable
* Enumerable#chunk and Enumerable#slice_before no longer takes the
initial_state argument. [Feature #10958]
Use a local variable instead to maintain a state.
* IO
* IO#close doesn't raise when the IO object is closed. [Feature #10718]
=== Stdlib updates (outstanding ones only)
* Socket
* Socket#accept_nonblock and Socket#connect_nonblock supports
`exception :false` to return symbols.
Ditto for TCPServer#accept_nonblock, UNIXServer#accept_nonblock.
* ObjectSpace (objspace)
* ObjectSpace.count_imemo_objects is added.
* OpenSSL
* OpenSSL::SSL::SSLSocket#accept_nonblock and
OpenSSL::SSL::SSLSocket#connect_nonblock supports `exception: false`.
=== Stdlib compatibility issues (excluding feature bug fixes)
* lib/webrick/utils.rb
* removed unused argument. https://github.com/ruby/ruby/pull/356
* lib/drb/drb.rb
* removed unused argument. https://github.com/ruby/ruby/pull/515
* lib/base64.rb
* Base64.urlsafe_encode64: added a "padding" option to suppress
the padding character ("=").
* Base64.urlsafe_decode64: now it accepts not only correctly-padded
input but also unpadded input.
* lib/matrix.rb
* Add Vector#round. https://github.com/ruby/ruby/pull/802
* ext/coverage/coverage.c
* Coverage.peek_result: new method to allow coverage to be captured without
stopping the coverage tool.
=== Built-in global variables compatibility issues
=== C API updates
=== Build system updates
=== Implementation changes