Re: Objects & arrays??
| From: | Thomas Hurst | Date: | Tue, 13 Jun 2000 19:15:24 +0000 |
| Subject: | Re: Objects & arrays?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1735@lists.php.net to get a copy of this message | ||
Hi
On 11-Jun-00 22:47:16, David Reid (dreid@jetnet.co.uk) wrote:
> I've just started playing with classes to hold information for a
> project, but I've run into some weirdness!
What sort of weirdness?
> So can structures only be nested 2 deep or am I doing something really
> wrong here?
Actually, I was curious, so I wrote a quick test script of my own...
I'm quite pleased with the result:
Generating huge object... Done!
Creating it...Done!
Testing it...OK! Current depth: 153
This was with an object containing 500 copies of itself. I ran out of space
in my text editor, so the depth doen't actually get tested directly that
far... the test line was;
<snip>
$bla->test->test->test->test->test->test->test->test->test->test->test->
test->test->test->test->test->test->test->test->test->test->test->test->
test->test->test->test->test->test->test->test->test->test->test->test->
test->test->test->test->test->test->test->test->test->test->test->test->
test->test->test->test->test->test->test->test->test->test->test->test->
test->test->test->test->test->test->test->test->test->test->test->test->
test->test->test->test->test->test->test->test->test->test->test->test->
test->test->test->test->test->test->test->test->test->test->test->test->
test->test->test->test->test->test->test->test->test->test->test->test->
test->test->test->test->test->test->test->test->test->test->test->test->
test->test->test->test->test->test->test->test->test->test->test->test->
test->test->test->test->test->test->test->test->test->test->test->test->
test->test->test->test->test->test->test->test->test->ok();
<snip>
And a more complete recursive test worked flawlessly.
I counted 2 seconds runtime on my server; a 16MB 486 DX2/66.
I tried with 5000 nests and the result is the same... although it took just
under 10 seconds and started swapping after a couple of runs.
Oh, and I just noticed a few segv's in error_log.. oops :)
Can anyone comment more on the overhead of objects? My current project needs
quite a lot of them. Do derived classess hold any sort of performance or
resource advantage?
Regards
Tom
--
Thomas 'Freaky' Hurst - On ARCNet - http://arcnet.vapor.com/
Team Member of AmiBench - http://www.amibench.org/
Full time ARexx, PHP, Linux and Amiga freak, student and bum
--
Customer: A primitive life form at the bottom of the food chain.