summaryrefslogtreecommitdiff
path: root/bench/regex-match.myr
diff options
context:
space:
mode:
Diffstat (limited to 'bench/regex-match.myr')
-rw-r--r--bench/regex-match.myr26
1 files changed, 26 insertions, 0 deletions
diff --git a/bench/regex-match.myr b/bench/regex-match.myr
new file mode 100644
index 0000000..a6219d3
--- /dev/null
+++ b/bench/regex-match.myr
@@ -0,0 +1,26 @@
+use std
+use regex
+
+const main = {
+ var str, re, i
+
+ str = "€i²æ&±-ŝ€i²æ&±-ŝ€i²æ&±-ŝ€i²æ&±-ŝ€i²æ&±-ŝüüü€i²æ&±-ŝüüü€i²æ&±-ŝü"
+ str = std.strcat(str, str)
+ str = std.strcat(str, str)
+ str = std.strcat(str, str)
+ str = std.strcat(str, str)
+
+ for i = 0; i < 100; i++
+ match regex.compile(".*")
+ | `std.Ok r: re = r
+ | `std.Fail m: std.fatal(1, "couldn't compile regex: %s\n", m)
+ ;;
+
+ match regex.exec(re, str)
+ | `std.Some m:
+ | `std.None: std.fatal(1, "Didn't match regex\n")
+ ;;
+
+ regex.free(re)
+ ;;
+}