Does assigning functions to variables help with performance?

I recall watching a video a while ago which said that doing something like

local cf =;
local cfAng = CFrame.Angles;
local rad = math.rad;

Is better than just typing out the function they point to. I see it in many community resources as well, and I don’t really have a straightforward answer to it.

Yes, according to the Lua Performance Tips, Chapter 2 book:


This is an optimization that is only really useful in RenderStepped, Stepped, and Heartbeat events that fire every frame. All optimizations that can be made in those loops should be made.