Print() function performance

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Quality game performance.

  2. What is the question? Server scripts that run the most basic function on Roblox. Print function that runs in a loop.

while task.wait() do
print("Hello World")
end

The game obviously requires performance to use the print function in a loop… despite how basic it is. Is it better to only use print for debugging? Or does it not take away performance at all when it isn’t spammed and is safe to use it after firing various functions?

Example of what I’m asking.

local function HelloMyFriend()
--function one here
print("Changed the humanoid state to jumping") --Does running me cause unnecessary lag?
end

local function HelloMyNemesis()
--function two here
print("Changed the humanoid state to dead") --Does running me cause unnecessary lag?
end

while task.wait(2) do
HelloMyFriend() --Prints so you can see what hellomyfriend function did
HelloMyNemesis()  --Prints so you can see what hellomynemesis function did
end

Print only causes issues if its being ran at really really high rates, like every frame. That’s what I’ve seen in Studio at least. Not sure about in an actual game.

1 Like

I wonder how it is on the client. I would really like to print things on the client but I don’t know if it’s a bad idea considering it can cause issues being at at really high rates

You can always try it out. Since printing is never really used for gameplay itself, then it should be primarily used for debugging.

1 Like

However, printing at high rates would overall just make things harder in studio, even if it doesn’t affect the client performance in the real game, due to it definitely lagging the game in studio.

1 Like