benchmark.regexp: simple regexp matching benchmark.

db4
John Benediktsson 2012-07-17 20:35:39 -07:00
parent 0359a4e823
commit 126fbd45a7
1 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,16 @@
! Copyright (C) 2012 John Benediktsson
! See http://factorcode.org/license.txt for BSD license.
USING: arrays fry kernel math math.parser regexp sequences
strings ;
IN: benchmark.regexp
: regexp-benchmark ( -- )
200
10,000 iota [ number>string ] map
200 iota [ 1 + CHAR: a <string> ] map
'[
_ R/ \d+/ [ matches? ] curry all? t assert=
_ R/ [a]+/ [ matches? ] curry all? t assert=
] times ;
MAIN: regexp-benchmark