Re: efficiency of hash v. object
| From: | Ignacio Vazquez-Abrams | Date: | Fri, 15 Dec 2000 18:41:30 +0000 |
| Subject: | Re: efficiency of hash v. object | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-30562@lists.php.net to get a copy of this message | ||
On Fri, 15 Dec 2000, Dean Hall wrote:
> Does anyone have any idea whether it's more efficient (in time, especially
> but in space as well) to store public data in an array (hash) or an
> object?
>
> I certainly like using my barewords and having the flexibility to
> dynamically add elements to an array, but perhaps an object is more
> efficient -- more like a C struct.
>
> Sorry, I haven't looked in the source; I'm not familiar with it at all.
>
> Dean.
>
AFAICT, they're about the same; objects are just slightly slower due to object
overhead (initialization, etc.). They both use a similar hash structure for
their variables.
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>