Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specialize to the global environment #910

Open
wants to merge 1 commit into
base: v2.1
Choose a base branch
from

Conversation

TurkeyMcMac
Copy link

This lets different functions in the same trace share global lookup code. Example code:

function g(n)
	return math.floor(n)
end

function f(n)
	return (g(math.ceil(n - 1.5)))
end

function bench()
	local s = 0
	local before = os.clock()
	for i = 1, 100000000 do
		s = s + f(i)
	end
	local after = os.clock()
	print(after - before, s)
end
jit.off(bench)

bench()

Without the patch, the benchmark time is about 3.6 on my computer. With the patch, the benchmark time is about 2.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant