diff options
author | Stefan Radomski <github@mintwerk.de> | 2017-06-27 11:12:07 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2017-06-27 11:12:07 (GMT) |
commit | 028f97fd12cca9e9cad23ce883c541c59cc7942b (patch) | |
tree | 55569364bdb8dc60b6506ab553d1eeb443675b96 /contrib/benchmarks/lxsc | |
parent | 3a5692f40663282640775f8ff497c4860d265a2a (diff) | |
download | uscxml-028f97fd12cca9e9cad23ce883c541c59cc7942b.zip uscxml-028f97fd12cca9e9cad23ce883c541c59cc7942b.tar.gz uscxml-028f97fd12cca9e9cad23ce883c541c59cc7942b.tar.bz2 |
Prepared benchmarks
Diffstat (limited to 'contrib/benchmarks/lxsc')
-rwxr-xr-x | contrib/benchmarks/lxsc/benchmark.sh | 8 | ||||
-rw-r--r-- | contrib/benchmarks/lxsc/test-performance.lua | 38 |
2 files changed, 46 insertions, 0 deletions
diff --git a/contrib/benchmarks/lxsc/benchmark.sh b/contrib/benchmarks/lxsc/benchmark.sh new file mode 100755 index 0000000..d0860ad --- /dev/null +++ b/contrib/benchmarks/lxsc/benchmark.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +git clone https://github.com/Phrogz/LXSC.git +cp ../../../test/benchmarks/findLCCA.scxml ./test.scxml + +lua ./test-performance.lua
\ No newline at end of file diff --git a/contrib/benchmarks/lxsc/test-performance.lua b/contrib/benchmarks/lxsc/test-performance.lua new file mode 100644 index 0000000..111fffa --- /dev/null +++ b/contrib/benchmarks/lxsc/test-performance.lua @@ -0,0 +1,38 @@ +#!/usr/bin/env lua + +package.path = 'LXSC/?.lua;' .. package.path + +require 'io' +require 'os' +local LXSC = require 'lxsc' + +local c,t,lxsc = os.clock + +local out = io.open(string.format("results-%s.txt",LXSC.VERSION),"w") +local sum=0 +function mark(msg,t2,n) + local delta = (t2-t)*1000/(n or 1) + sum = sum + delta + out:write(string.format("%25s: %5.2fms\n",msg,delta)) +end + +local xml = io.open("test.scxml"):read("*all") +t = c() +for i=1,20 do lxsc = LXSC:parse(xml) end +mark("Parse XML",c(),20) + +lxsc.onAfterEnter = function(id,kind) + if (id=="id401") then + print("Entered "..kind.." '"..tostring(id).."'") + end +end + +t = c() +lxsc:start() +mark("Start Machine",c()) + + +out:write("----------------------------------\n") +out:write(string.format("%25s: %5.2fms ± 20%%\n","Total time",sum)) + +out:close()
\ No newline at end of file |