Arrays size and memory

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sn4k3
Forum Commoner
Posts: 37
Joined: Tue Oct 16, 2007 3:51 pm

Arrays size and memory

Post 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
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Arrays size and memory

Post by Christopher »

I doubt you will find any performance difference, especially with arrays that small.
(#10850)
sn4k3
Forum Commoner
Posts: 37
Joined: Tue Oct 16, 2007 3:51 pm

Re: Arrays size and memory

Post by sn4k3 »

ok thanks for the anwser :)
Post Reply