diff options
Diffstat (limited to 'Data/BuiltIn/Libraries/json4lua/examples/timetrials.lua')
-rw-r--r-- | Data/BuiltIn/Libraries/json4lua/examples/timetrials.lua | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Data/BuiltIn/Libraries/json4lua/examples/timetrials.lua b/Data/BuiltIn/Libraries/json4lua/examples/timetrials.lua new file mode 100644 index 0000000..cbda514 --- /dev/null +++ b/Data/BuiltIn/Libraries/json4lua/examples/timetrials.lua @@ -0,0 +1,46 @@ +--[[
+ Some Time Trails for the JSON4Lua package
+]]--
+
+
+require('json')
+require('os')
+require('table')
+
+local t1 = os.clock()
+local jstr
+local v
+for i=1,100 do
+ local t = {}
+ for j=1,500 do
+ table.insert(t,j)
+ end
+ for j=1,500 do
+ table.insert(t,"VALUE")
+ end
+ jstr = json.encode(t)
+ v = json.decode(jstr)
+ --print(json.encode(t))
+end
+
+for i = 1,100 do
+ local t = {}
+ for j=1,500 do
+ local m= math.mod(j,3)
+ if (m==0) then
+ t['a'..j] = true
+ elseif m==1 then
+ t['a'..j] = json.null
+ else
+ t['a'..j] = j
+ end
+ end
+ jstr = json.encode(t)
+ v = json.decode(jstr)
+end
+
+print (jstr)
+--print(type(t1))
+local t2 = os.clock()
+
+print ("Elapsed time=" .. os.difftime(t2,t1) .. "s")
\ No newline at end of file |