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
.document
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
depend
extconf.rb
getaddrinfo.c
getnameinfo.c
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
mkconstants.rb
option.c
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
sockssocket.c
tcpserver.c
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
unixsocket.c fix unbalanced square brackets 2015-06-16 14:40:20 +00:00