local function PrintNoConvert(something: number)
print(something)
end
local function PrintConvert(something: number)
local converted = tostring(something)
print(converted)
end
PrintNoConvert(8)
PrintConvert(2)
-- is there a difference in speed?
No, I tested it by replicating your system and adding os.clock() for microsecond precision, non-converted value is always faster because tostring() is another function along with print() and each function requires a very small delay to process and run. Here is the script if you are curious:
local function PrintNoConvert(something: number)
local startTime = os.clock()
print(something)
print(os.clock() - startTime)
end
local function PrintConvert(something: number)
local startTime = os.clock()
local converted = tostring(something)
print(converted)
print(os.clock() - startTime)
end
PrintNoConvert(5)
task.wait(1)
PrintConvert(5)