aboutsummaryrefslogtreecommitdiff
path: root/tests/linda_perf.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/linda_perf.lua')
-rw-r--r--tests/linda_perf.lua35
1 files changed, 30 insertions, 5 deletions
diff --git a/tests/linda_perf.lua b/tests/linda_perf.lua
index a50e906..4d35380 100644
--- a/tests/linda_perf.lua
+++ b/tests/linda_perf.lua
@@ -62,12 +62,13 @@ local lane_gobbler_gen = lanes.gen( "*", {priority = 3}, gobbler)
62local function ziva( preloop, loop, batch) 62local function ziva( preloop, loop, batch)
63 -- prefill the linda a bit to increase fifo stress 63 -- prefill the linda a bit to increase fifo stress
64 local top = math.max( preloop, loop) 64 local top = math.max( preloop, loop)
65 local l, lane = lanes.linda() 65 local l = lanes.linda()
66 local t1 = lanes.now_secs() 66 local t1 = lanes.now_secs()
67 for i = 1, preloop do 67 for i = 1, preloop do
68 l:send( "key", i) 68 l:send( "key", i)
69 end 69 end
70 print( "stored " .. l:count( "key") .. " items in the linda before starting consumer lane") 70 print( "stored " .. l:count( "key") .. " items in the linda before starting consumer lane")
71 local lane
71 if batch > 0 then 72 if batch > 0 then
72 if l.batched then 73 if l.batched then
73 lane = lane_gobbler_gen( l, top, batch) 74 lane = lane_gobbler_gen( l, top, batch)
@@ -103,6 +104,28 @@ local function ziva( preloop, loop, batch)
103end 104end
104 105
105-- ################################################################################################# 106-- #################################################################################################
107do
108 print "############################################ tests get/set"
109 -- linda:get throughput
110 local l = lanes.linda("get/set")
111 local batch = {}
112 for i = 1,1000 do
113 table.insert(batch, i)
114 end
115 for _,size in ipairs{1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987 } do
116 l:set("<->", table_unpack(batch))
117 local count = 20000000//size
118 print("START", "get("..size..") " .. count, " times")
119 local t1 = lanes.now_secs()
120 for i = 1, 2000000/math.sqrt(size) do
121 l:get("<->", size)
122 end
123 print("DURATION = " .. lanes.now_secs() - t1 .. "\n")
124 end
125end
126
127do return end
128-- #################################################################################################
106 129
107TEST1 = TEST1 or 1000 130TEST1 = TEST1 or 1000
108PREFILL1 = PREFILL1 or 10000 131PREFILL1 = PREFILL1 or 10000
@@ -118,8 +141,9 @@ local tests1 =
118 { PREFILL1, FILL1, 8}, 141 { PREFILL1, FILL1, 8},
119 { PREFILL1, FILL1, 13}, 142 { PREFILL1, FILL1, 13},
120 { PREFILL1, FILL1, 21}, 143 { PREFILL1, FILL1, 21},
121 { PREFILL1, FILL1, 44}, 144 { PREFILL1, FILL1, 34},
122 { PREFILL1, FILL1, 65}, 145 { PREFILL1, FILL1, 55},
146 { PREFILL1, FILL1, 89},
123} 147}
124print "############################################ tests #1" 148print "############################################ tests #1"
125for i, v in ipairs( tests1) do 149for i, v in ipairs( tests1) do
@@ -194,8 +218,9 @@ local tests2 =
194 { PREFILL2, FILL2, 8}, 218 { PREFILL2, FILL2, 8},
195 { PREFILL2, FILL2, 13}, 219 { PREFILL2, FILL2, 13},
196 { PREFILL2, FILL2, 21}, 220 { PREFILL2, FILL2, 21},
197 { PREFILL2, FILL2, 44}, 221 { PREFILL2, FILL2, 34},
198 { PREFILL2, FILL2, 65}, 222 { PREFILL2, FILL2, 55},
223 { PREFILL2, FILL2, 89},
199} 224}
200 225
201print "############################################ tests #2" 226print "############################################ tests #2"