Quantcast
Channel: User Louis - Stack Overflow
Viewing all articles
Browse latest Browse all 37

PHP Objects vs Arrays -- Performance comparison while iterating

$
0
0

I have a huge amount of PHP objects for a neural network for which I have to iterate over and perform some maths on. I was wondering if I would be better off using an associative array over instances of classes?

I am dealing with around 3640 objects and iterating around 500 times (at best) on top of that so any micro-optimization helps a great deal. Would it inevitably be quicker to do $object['value'] than $object->value?

Edit: So they are both the same. But I guess there would be a little overhead for the constructor? Either way I don't think I want to trade in my beautiful classes for dirty arrays :P


Viewing all articles
Browse latest Browse all 37

Latest Images

Trending Articles





Latest Images