wepnop Posted April 14, 2011 Share Posted April 14, 2011 Im going to use a large array of arrays, each of one having a lot of values and some sub arrays. My question is... is faster to use arrays or is better to have a object to acces using methods and all? i suppose objects are slower... Also i was planing in use arrays with string keys in nearly all places, normally these are slower, but in php hashes and arrays are the same tipe so i dont know... Quote Link to comment https://forums.phpfreaks.com/topic/233705-speed-performance/ Share on other sites More sharing options...
alex848 Posted April 14, 2011 Share Posted April 14, 2011 benchmark this one. Unfortunatelly i forget book there i found code for benchmark, somfind do with timers. i am php newbie Quote Link to comment https://forums.phpfreaks.com/topic/233705-speed-performance/#findComment-1201506 Share on other sites More sharing options...
ignace Posted April 14, 2011 Share Posted April 14, 2011 How LARGE is large? Quote Link to comment https://forums.phpfreaks.com/topic/233705-speed-performance/#findComment-1201508 Share on other sites More sharing options...
wepnop Posted April 14, 2011 Author Share Posted April 14, 2011 How LARGE is large? This is my actual code, but it can grow more, it will have like 15 items or more of these tipe maybe, because its a inventory aplication. $categorias['Memoria Ram'] = array( # El nombre ha de coincidir con el de la tabla sql 'nombre' => 'Memoria RAM', # Titulo de la pagina 'titulo' => 'Insertar memoria RAM', # Encabezado de la pagina 'encabezado' => 'Insertar memoria RAM', # Campos del formulario, tipo, nombre y descripcion para cada uno. Ordenados como saldran. 'campos' => array( 0 => array( 'tipo' => 1, 'nombre' => 'Cantidad', 'descripcion' => 'La cantidad de MB de capacidad.' ), 1 => array( 'tipo' => 2, 'nombre' => 'Tipo', 'descripcion' => 'El tipo de memoria RAM' ), 2 => array( # Tipo: 1: numero, 2: texto, 3: lista de opciones 'tipo' => 3, # Ha de coincidir con el campo sql 'nombre sql' => 'Tecnologia', # Nombre usado por la web 'nombre' => 'Tecnologia', # Descripcion del elemento 'descripcion' => 'El tipo de tecnologia de la memoria RAM', # Solo se usaria la lista en caso de tipo3 'opciones' => array('DDR', 'DDR2', 'DDR3', 'SDR') ) The correct is the last one, that uses more entries in the hash. The $campos array may be somewhat large also. I suppose that i will add some extra info to it, anyway, these are sketches, and this have to be readed frecuently. Quote Link to comment https://forums.phpfreaks.com/topic/233705-speed-performance/#findComment-1201511 Share on other sites More sharing options...
wepnop Posted April 29, 2011 Author Share Posted April 29, 2011 Now im planning to use xml objects, because this is is readed from a txt file. I will use simplexml, its ok for what i need. I suppose it have less performance... anyway... Quote Link to comment https://forums.phpfreaks.com/topic/233705-speed-performance/#findComment-1208054 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.