Adding a UDP echo benchmark.

db4
John Benediktsson 2011-08-26 17:18:08 -07:00
parent 6ca88c1f79
commit daaaed7e2b
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
! Copyright (C) 2010 John Benediktsson
! See http://factorcode.org/license.txt for BSD license
USING: accessors destructors kernel io.binary io.sockets
sequences ;
IN: benchmark.echo
: send/recv ( packet server client -- )
[ over over addr>> ] [ send ] bi* receive drop assert= ;
: udp-echo ( -- )
[
10000 iota [ 4 >be ] map
f 0 <inet4> <datagram>
f 0 <inet4> <datagram>
[ send/recv ] 2curry each
] with-destructors ;
MAIN: udp-echo