Page 1 of 1

coding question

Posted: Sun Mar 24, 2019 3:21 am
by Ememjr
this is just a generic question on speed for our server
for example, we are sending 1000 intventory items to a client(a hoarder like me)
typically there is a loop the iterates through the inventory and decides how the packet is set up based on the client version

so during login when items are first sent and getversion is called over 1000 times

do you think it would speed things up to call get client version just before the loop starts then refer to that in the loop or does c++ compile in a way there is a non noticeable difference

i wish i knew how to test the speed of a set up instructions

Re: coding question

Posted: Sun Mar 24, 2019 4:02 pm
by Jabantiz
There will be a small over head in calling a function vs reading a variable. but it is usually insignificant. If the function is inline then the compiler will change it so it is the same as if using the variable.

Performance wise I do not think you would see an impact one way or another with those amounts.