summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorMura Li <github@ctli.io>2019-10-23 15:14:24 +0800
committerMura Li <github@ctli.io>2019-10-29 10:02:52 +0800
commit16b894430a5b71f4956ee305229bbbffd13605d0 (patch)
tree64af8620c0ef314e9eb8fd83d8bcfeac0b8e6007 /support
parente9b59bee4efb648e323dfb6269209b59c575806f (diff)
downloadmc-16b894430a5b71f4956ee305229bbbffd13605d0.tar.gz
Merge decision tree nodes when possible
(Tested on Linux/AMD64) Sample count: 506 Dtree Refcnt avg: 5.38 95th percentile: 3.00 maximum: 100 Dtree Size avg: 5.23 95th percentile: 3.00 maximum: 84 Dtree Height avg: 1.39 95th percentile: 1.00 maximum: 12 References: Mikael Pettersson. A term pattern-match compiler inspired by finite automata theory. (p.6 "Step 3: Optimizing the DFA")
Diffstat (limited to 'support')
-rwxr-xr-xsupport/matchstats.myr9
1 files changed, 8 insertions, 1 deletions
diff --git a/support/matchstats.myr b/support/matchstats.myr
index ae20ae9..b0375d5 100755
--- a/support/matchstats.myr
+++ b/support/matchstats.myr
@@ -60,7 +60,7 @@ const maximum = {xs
}
const main = {args : byte[:][:]
- var f, locs, sizes, heights, count
+ var f, locs, refcnts, sizes, heights, count
if args.len < 2
std.put("need input file\n")
@@ -73,6 +73,7 @@ const main = {args : byte[:][:]
;;
locs = [][:]
+ refcnts = [][:]
sizes = [][:]
heights = [][:]
count = 0
@@ -85,6 +86,11 @@ const main = {args : byte[:][:]
;;
match bio.readto(f, ",")
+ | `std.Ok refcnt: std.slpush(&refcnts, atoi(std.strstrip(refcnt)))
+ | `std.Err e: std.fatal("error read refcnt: {}\n", e)
+ ;;
+
+ match bio.readto(f, ",")
| `std.Ok size: std.slpush(&sizes, atoi(std.strstrip(size)))
| `std.Err e: std.fatal("error read size: {}\n", e)
;;
@@ -97,6 +103,7 @@ const main = {args : byte[:][:]
;;
std.put("Sample count: {}\n", count)
+ std.put("Dtree Refcnt\tavg: {s=3}\t95th percentile: {s=3}\t maximum: {}\n", avg(refcnts), percentile(95, refcnts), maximum(refcnts))
std.put("Dtree Size\tavg: {s=3}\t95th percentile: {s=3}\t maximum: {}\n", avg(sizes), percentile(95, sizes), maximum(sizes))
std.put("Dtree Height\tavg: {s=3}\t95th percentile: {s=3}\t maximum: {}\n", avg(heights), percentile(95, heights), maximum(heights))