Page 1 of 1

Arrays size and memory

Posted: Wed Oct 12, 2011 8:46 pm
by sn4k3
Hi,

i have an array that contains all games from db table (id, name, icon, teams, played, spent)
this array is not big, since data is small and less than 5/10 rows

after for each game i have a gametype (id, gameid, name, description, played, spent)

and also i have maps (id, gameid, gametypes, name, played, spent)

so right now im joinning results to just 1 array

gametypes and maps will join to game array like that: game[0]['gametypes'] = array(...); and game[0]['maps'] = array(...);

theres the code

Code: Select all

if($withGameTypes && !isset($game['gametypes']))
		{	
			$game = self::joinGametypes($value);
		}
		if($withMaps && !isset($game['maps']))
		{	
			$game = self::joinMaps($value, false);
		}
		return $game;
for for multi dimension array games i will join another 2 multi dimension array

gametypes have about 5/10 in max rows but have description text, not big but its html
maps can be about 20/30 in max

so i want to ask if that affect performance or speed and if is different if i do:

Code: Select all

$game = Game::get(id);
$gametypes = Gametype::getForGame(id);
$maps = Map::getForGame(id);
so having 3 diferente array variables will be better to server performance and speed? or it all goes to same?

thanks

Re: Arrays size and memory

Posted: Thu Oct 13, 2011 2:53 am
by Christopher
I doubt you will find any performance difference, especially with arrays that small.

Re: Arrays size and memory

Posted: Thu Oct 13, 2011 7:45 am
by sn4k3
ok thanks for the anwser :)