Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --THIS:
- local trials = {}
- local funcs = [[
- ->
- for i = 1, 5 do
- print("i : " .. i)
- end
- <-
- ->
- for x = 1, 5 do
- print("x : " .. x)
- end
- <-
- ]]
- for i = 1, 200 do
- local now = tick()
- sp(funcs).multiCall()
- sp(trials).insert(tick() - now)
- end
- print("AVERAGE RUN TIME : " .. sp(trials).average())
- --INSTEAD OF THIS:
- local trials = {}
- local funcs = [[
- ->
- for i = 1, 5 do
- print("i : " .. i)
- end
- <-
- ->
- for x = 1, 5 do
- print("x : " .. x)
- end
- <-
- ]]
- for i = 1, 200 do
- local now = tick()
- funcs:gsub("%->.+<%-", function(match)
- loadstring(match:gsub("[%-<*>*]+", ""))()
- end)
- table.insert(trials, tick() - now)
- end
- local average = 0
- for _, number in ipairs(trials) do
- average = average + number
- end
- print("AVERAGE RUN TIME : " .. average / #trials)
Advertisement
Add Comment
Please, Sign In to add comment