ruby/ext/socket
normal eda2441b53 socket: avoid arg parsing in bsock_sendmsg_internal
* ext/socket/ancdata.c (bsock_sendmsg_internal): avoid arg parsing
  [ruby-core:71439] [Feature #11339]
  (rsock_bsock_sendmsg): make private, adjust for above
  (rsock_bsock_sendmsg_nonblock): ditto
* ext/socket/rubysocket.h: adjust prototypes
  (rsock_opt_false_p): remove
* ext/socket/basicsocket.c (rsock_init_basicsocket):
  define private methods
* ext/socket/lib/socket.rb (BasicSocket#sendmsg): new wrapper
  (BasicSocket#sendmsg_nonblock): ditto

target 0: a (ruby 2.3.0dev (2015-11-12 trunk 52550) [x86_64-linux])
target 1: b (ruby 2.3.0dev (2015-11-12 avoid-kwarg-capi 52550) [x86_64-linux]

-----------------------------------------------------------
sendmsg_nonblock

require 'socket'
nr = 1_000_000
i = 0
msg = '.'
buf = '.'
begin
  r, w = UNIXSocket.pair(:SEQPACKET)
  while i < nr
    i += 1
    w.sendmsg_nonblock(msg, exception: false)
    r.recv(1, 0, buf)
  end
ensure
  r.close
  w.close
end

-----------------------------------------------------------
raw data:

[["sendmsg_nonblock",
  [[1.875997293740511,
    1.8452614955604076,
    1.8449317328631878,
    1.8418389447033405,
    1.869386937469244],
   [1.5175109766423702,
    1.4987873211503029,
    1.4989623799920082,
    1.47918451577425,
    1.5017359890043736]]]]

Elapsed time: 16.775453245 (sec)
-----------------------------------------------------------
benchmark results:
minimum results in each 5 measurements.
Execution time (sec)
name             a       b
sendmsg_nonblock   1.842   1.479

Speedup ratio: compare with the result of `a' (greater is better)
name             b
sendmsg_nonblock   1.245

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-17 01:05:30 +00:00
..
lib socket: avoid arg parsing in bsock_sendmsg_internal 2015-11-17 01:05:30 +00:00
.document * ext/socket/.document: Add ifaddr.c. 2013-05-14 14:48:00 +00:00
addrinfo.h * ext/**/*.[ch]: removed trailing spaces. 2010-04-22 08:04:13 +00:00
ancdata.c socket: avoid arg parsing in bsock_sendmsg_internal 2015-11-17 01:05:30 +00:00
basicsocket.c socket: avoid arg parsing in bsock_sendmsg_internal 2015-11-17 01:05:30 +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 * ChangeLog: Good-bye OS/2. 2015-10-18 01:18:34 +00:00
getaddrinfo.c * configure.in: fixed build failure of Haiku. 2015-10-24 13:51:25 +00:00
getnameinfo.c * configure.in: fixed build failure of Haiku. 2015-10-24 13:51:25 +00:00
ifaddr.c ifaddr.c: wrapper object before alloc 2015-05-16 12:57:17 +00:00
init.c socket: avoid arg parsing in rsock_s_accept_nonblock 2015-11-16 23:40:15 +00:00
ipsocket.c rsock_addrinfo: specify address family 2015-10-13 03:14:13 +00:00
mkconstants.rb * ext/socket/mkconstants.rb: More constants 2014-05-23 20:54:40 +00:00
option.c use rb_sym2str 2015-08-15 04:32:15 +00:00
raddrinfo.c suppress a warning 2015-10-19 16:28:56 +00:00
rubysocket.h socket: avoid arg parsing in bsock_sendmsg_internal 2015-11-17 01:05:30 +00:00
socket.c socket: avoid arg parsing in rsock_s_accept_nonblock 2015-11-16 23:40:15 +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 socket: avoid arg parsing in rsock_s_accept_nonblock 2015-11-16 23:40:15 +00:00
tcpsocket.c rsock_addrinfo: specify address family 2015-10-13 03:14:13 +00:00
udpsocket.c socket: avoid arg parsing in rsock_s_recvfrom_nonblock 2015-11-16 23:25:03 +00:00
unixserver.c socket: avoid arg parsing in rsock_s_accept_nonblock 2015-11-16 23:40:15 +00:00
unixsocket.c fix unbalanced square brackets 2015-06-16 14:40:20 +00:00