1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/socket
normal 6dda4f17a9 socket: memoize common socket families in fptr->mode
This provides a minor speedup by avoiding an extra syscall

	require 'socket'
	require 'benchmark'
	nr = 100000
	msg = 'hello world'
	buf = ''
	size = msg.bytesize
	puts(Benchmark.measure do
	  UNIXSocket.pair(:SEQPACKET) do |a, b|
	    nr.times do
	      a.sendmsg_nonblock(msg, 0, exception: false)
	      b.recv(size, 0, buf)
	    end
	  end
	end)

             user     system      total        real
before:  0.330000   0.340000   0.670000 (  0.678235)
 after:  0.290000   0.240000   0.530000 (  0.534527)

* ext/socket/rubysocket.h: flags for common socket families
  (rsock_getfamily): update signature
* include/ruby/io.h: comment socket FMODE flags
* ext/socket/init.c (rsock_getfamily): memoize family
* ext/socket/basicsocket.c: adjust rsock_getfamily calls
* ext/socket/ancdata.c: ditto
  [ruby-core:69713] [Feature #11298]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02 01:58:14 +00:00
..
lib stdlib: use IO#wait_*able instead of IO.select when possible 2015-05-06 20:30:43 +00:00
.document * ext/socket/.document: Add ifaddr.c. 2013-05-14 14:48:00 +00:00
addrinfo.h
ancdata.c socket: memoize common socket families in fptr->mode 2015-07-02 01:58:14 +00:00
basicsocket.c socket: memoize common socket families in fptr->mode 2015-07-02 01:58:14 +00:00
constants.c use frozen string of symbols 2015-04-14 03:31:28 +00:00
depend Update dependencies. 2014-12-19 13:34:54 +00:00
extconf.rb * ext/socket/extconf.rb: Solaris 11 has struct tcp_info.tcpi_ca_state, 2015-03-25 08:10:14 +00:00
getaddrinfo.c getaddrinfo.c: GHOST vulnerability check 2015-02-08 04:04:32 +00:00
getnameinfo.c {getaddrinfo,getnameinfo}.c: fix for old platforms 2013-05-03 04:35:37 +00:00
ifaddr.c ifaddr.c: wrapper object before alloc 2015-05-16 12:57:17 +00:00
init.c socket: memoize common socket families in fptr->mode 2015-07-02 01:58:14 +00:00
ipsocket.c ipsocket.c: fix merge miss 2015-04-30 07:45:36 +00:00
mkconstants.rb * ext/socket/mkconstants.rb: More constants 2014-05-23 20:54:40 +00:00
option.c * ext/socket/extconf.rb: Solaris 11 has struct tcp_info.tcpi_ca_state, 2015-03-25 08:10:14 +00:00
raddrinfo.c raddrinfo.c: suppress a warning 2015-06-14 23:40:51 +00:00
rubysocket.h socket: memoize common socket families in fptr->mode 2015-07-02 01:58:14 +00:00
socket.c * include/ruby/ruby.h: $SAFE=3 is now obsolete. 2015-06-17 05:29:51 +00:00
sockport.h * ext/socket: Bypass getaddrinfo() if node and serv are numeric. 2014-02-19 10:37:43 +00:00
sockssocket.c * ext/socket/basicsocket.c, ext/socket/sockssocket.c: 2014-12-07 10:40:27 +00:00
tcpserver.c accept_nonblock supports "exception: false" 2015-03-12 03:03:04 +00:00
tcpsocket.c * include/ruby/ruby.h: $SAFE=3 is now obsolete. 2015-06-17 05:29:51 +00:00
udpsocket.c * include/ruby/ruby.h: $SAFE=3 is now obsolete. 2015-06-17 05:29:51 +00:00
unixserver.c accept_nonblock supports "exception: false" 2015-03-12 03:03:04 +00:00
unixsocket.c fix unbalanced square brackets 2015-06-16 14:40:20 +00:00