Does this affect performance?

Hey there! I was just wondering out of curiosity if the following will affect performance:

Would using:

IntValue.Changed:Connect(function(newValue)
    print("Line 1 of Connect")
    print("Line 2 of Connect")
end)

Be slower than using:

IntValue.Changed:Connect(function()
    print("Line 1 Connect")
    print("Line 2 Connect")
end

So the question is: Will taking in the automatically passed parameter and NOT using it SLOWER the an NOT taking in the parameter

1 Like

In theory, maybe. In practice, there will be no difference. The only way to know exactly is to measure it.

I don’t think it would be slower, as the game already passed that parameter, you just take or don’t take it. If you don’t use it at all, there’s no reason to even take it, so you shouldn’t. But no, it doesn’t affect performance

3 Likes

Yeah, that’s why I asked. As for

Yeah I usually don’t take it. I actually got most of time I used it didn’t know it existed

Any difference is going to be negligible, behind the scenes the function still receives the value, it’s just discarded instantaneously, as opposed to it being garbage collected at the end of the function call’s life-cycle.

2 Likes