Module:Sandbox/Ahecht/benchmark

This is the current revision of this page, as edited by Ahecht (talk | contribs) at 14:59, 31 March 2022 (add benchmarks). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
local p = {}

function p.ustring()
	for i = 1, 1000000 do 
		mw.ustring.match(" abcde ",'%S')
	end
	return "done"
end

function p.string()
	for i = 1, 1000000 do 
		string.match(" abcde ",'%S')
	end
	return "done"
end

function p.ipairs()
	a = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
	for i = 1, 1000000 do 
		for k, v in ipairs(a) do
		end
	end
	return "done"
end

function p.pairs()
	a = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
	for i = 1, 1000000 do 
		for k, v in pairs(a) do
		end
	end
	return "done"
end
return p