From aec1d8a65052364f4946556e36d276b34e62bdcf Mon Sep 17 00:00:00 2001 From: Ori Bernstein Date: Sun, 4 Feb 2018 18:37:51 -0800 Subject: Free up regexes/strings after benchmark. It's not important to do, but we want to be a good example for newbies. --- bench/regex-match.myr | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bench/regex-match.myr b/bench/regex-match.myr index bb268f2..78a31b4 100644 --- a/bench/regex-match.myr +++ b/bench/regex-match.myr @@ -6,12 +6,11 @@ var str var dotstar, hello, world const main = { - str = std.sldup("hello world!") - str = std.strcat(str, str) - str = std.strcat(str, str) - str = std.strcat(str, str) - str = std.strcat(str, str) - str = std.strcat(str, "x") + str = "" + for var i = 0; i < 16; i++ + std.sljoin(&str, "hello world!") + ;; + std.sljoin(&str, "x") dotstar = std.try(regex.compile(".*")) hello = std.try(regex.compile("hel*o")) @@ -22,6 +21,11 @@ const main = { [.name="searchhello", .fn=searchhello], [.name="searchworld", .fn=searchworld], ][:]) + + regex.free(dotstar) + regex.free(hello) + regex.free(world) + std.slfree(str) } const matchall = {ctx -- cgit v1.1