Server memory optimization
#6

Quote:
Originally Posted by Vince
Посмотреть сообщение
Yes. I praise you for finding this out yourself. Got a tutorial in my sig (don't know which one) that's on this topic, as well.



Unrelated, but pro tip: you can put multiple conditions in the loop header itself. If the condition isn't met the loop stops. Whereas with a nested if the loop keeps on running until it's done, even if there's no more space to store data. So in this case you might write:
PHP код:
for(new 0cache_get_row_count(); && MAX_BUILDINGS++) 
Thank you! Could you explain what the difference of these conditions do and why they're important?

PHP код:
for(new 0MAX_BUILDINGS++) 
PHP код:
for(new 0cache_get_row_count(); && MAX_BUILDINGS++) 
My guess is that if I run the first loop with MAX_BUILDINGS defined 50, the loop will go around 50 times?
However if I use the second one, the loop will run for as many rows that are returned by the query, so that if the query only returns 5 rows, the loop won't go around 45 times for nothing, which also works vice-versa with
PHP код:
&& MAX_BUILDINGS
which makes the loop stop, if the query should return 200 rows and I've defined the maximum number of buildings to be 50?
Reply


Messages In This Thread
Server memory optimization - by introzen - 04.04.2016, 15:13
Re: Server memory optimization - by AndySedeyn - 04.04.2016, 15:22
Re: Server memory optimization - by introzen - 04.04.2016, 15:28
Re: Server memory optimization - by Vince - 04.04.2016, 15:33
Re: Server memory optimization - by AndySedeyn - 04.04.2016, 15:37
Re: Server memory optimization - by introzen - 04.04.2016, 15:45
Re: Server memory optimization - by AndySedeyn - 04.04.2016, 15:51
Re: Server memory optimization - by introzen - 04.04.2016, 15:53

Forum Jump:


Users browsing this thread: 1 Guest(s)