coding question

Code pertaining to the server

Moderator: Team Members

Post Reply
User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

coding question

Post by Ememjr » Sun Mar 24, 2019 3:21 am

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

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: coding question

Post by Jabantiz » Sun Mar 24, 2019 4:02 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests