summaryrefslogtreecommitdiffstats
path: root/contrib/benchmarks/lxsc/statesPerSecond.lua
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/benchmarks/lxsc/statesPerSecond.lua')
-rw-r--r--contrib/benchmarks/lxsc/statesPerSecond.lua32
1 files changed, 32 insertions, 0 deletions
diff --git a/contrib/benchmarks/lxsc/statesPerSecond.lua b/contrib/benchmarks/lxsc/statesPerSecond.lua
new file mode 100644
index 0000000..8469ea5
--- /dev/null
+++ b/contrib/benchmarks/lxsc/statesPerSecond.lua
@@ -0,0 +1,32 @@
+#!/usr/bin/env lua
+
+package.path = 'LXSC/?.lua;' .. package.path
+
+require 'io'
+require 'os'
+local LXSC = require 'lxsc'
+local file = ...
+local init, mark, now
+local iterations = 0
+
+local started = os.clock()
+local xml = io.open(file):read("*all")
+lxsc = LXSC:parse(xml)
+
+lxsc.onAfterEnter = function(id,kind)
+ if (id=="mark") then
+ iterations = iterations + 1
+ now = os.clock()
+ if (now - mark > 1) then
+ print(init .. ", " .. iterations)
+ mark = now
+ iterations = 0
+ end
+ end
+end
+
+now = os.clock()
+init = (now - started) * 1000;
+mark = now
+
+lxsc:start()