Re: [PHP-DEV] How deep is copy on write?

2011-01-19 Thread Hannes Landeholm
Using references does not speed up PHP. It does that already internally, if I'm not mistaken. The point of my post was that assigning values to tree arrays are in general faster than a full array copy. Hannes On 19 January 2011 08:36, Ben Schmidt mail_ben_schm...@yahoo.com.au wrote: Yep. PHP

[PHP-DEV] [citations for] Re: [PHP-DEV] Experiments with a threading library for Zend: spawning a new executor

2011-01-19 Thread Sam Vilain
On 19/01/11 16:14, Sam Vilain wrote: In general, Java's basic types typically correspond with types that can be dealt with atomically by processors, or are small enough to be passed by value. This already makes things a lot easier. I've had another reason for the differences explained to me.

Re: [PHP-DEV] How deep is copy on write?

2011-01-19 Thread Martin Scotta
What about objects? class Foo { public $foo; } function test($o) { $o-foo-foo-foo = 2; } $bar = new Foo; $bar-foo = new Foo; $bar-foo-foo = new Foo; test( $bar ); --- Also... is it better to pass an object as a parameter rather than many values? function withValues($anInteger,

Re: [PHP-DEV] [citations for] Re: [PHP-DEV] Experiments with a threading library for Zend: spawning a new executor

2011-01-19 Thread Martin Scotta
I think the point is that the php language itself does not provide solid construct for writing rock-solid code. Yes, there are many programmers/hackers that can, but the effort they put is huge. it's so easy to break well-written bug-free code, that's impossible for developers to share libraries,

Re: [PHP-DEV] [citations for] Re: [PHP-DEV] Experiments with a threading library for Zend: spawning a new executor

2011-01-19 Thread Pierre Joye
hi, On Wed, Jan 19, 2011 at 4:41 PM, Martin Scotta martinsco...@gmail.com wrote: I think the point is that the php language itself does not provide solid construct for writing rock-solid code. Yes, there are many programmers/hackers that can, but the effort they put is huge. Care to enlighten

Re: [PHP-DEV] [citations for] Re: [PHP-DEV] Experiments with a threading library for Zend: spawning a new executor

2011-01-19 Thread Rasmus Lerdorf
On 1/19/11 7:50 AM, Pierre Joye wrote: Honestly if a given part of an application needs something along this line for performance reasons, then doing that on the same box where the request is executed may be a bad idea. Tools like gearman will do a far better jobs and will let you do resource

Re: [PHP-DEV] How deep is copy on write?

2011-01-19 Thread Gustavo Lopes
On Wed, 19 Jan 2011 14:23:49 -, Martin Scotta martinsco...@gmail.com wrote: What about objects? With objects less copying occurs because the object value (zval) data is actually just a pointer and an id that for most purposes works as a pointer. However, it should be said that

Re: [PHP-DEV] How deep is copy on write?

2011-01-19 Thread la...@garfieldtech.com
So it sounds like the general answer is that if you pass a complex array to a function by value and mess with it, data is duplicated for every item you modify and its direct ancestors up to the root variable but not for the rest of the tree. For objects, because of their pass by handle-type

Re: [PHP-DEV] How deep is copy on write?

2011-01-19 Thread Peter Lind
On 19 January 2011 20:05, la...@garfieldtech.com la...@garfieldtech.com wrote: So it sounds like the general answer is that if you pass a complex array to a function by value and mess with it, data is duplicated for every item you modify and its direct ancestors up to the root variable but not

Re: [PHP-DEV] [citations for] Re: [PHP-DEV] Experiments with a threading library for Zend: spawning a new executor

2011-01-19 Thread Stas Malyshev
Hi! I think the point is that the php language itself does not provide solid construct for writing rock-solid code. Yes, there are many programmers/hackers that can, but the effort they put is huge. I think this is completely untrue. In Java you are free to extend a class --yours or

Re: [PHP-DEV] Experiments with a threading library for Zend: spawning a new executor

2011-01-19 Thread Ángel González
Have you taken a look at Runkit_Sandbox? It may provide useful tips. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Experiments with a threading library for Zend: spawning a new executor

2011-01-19 Thread Sam Vilain
On 20/01/11 10:17, Ángel González wrote: Have you taken a look at Runkit_Sandbox? It may provide useful tips. *headdesk* No, I hadn't seen that. Thanks for pointing this out, it looks like exactly what I was trying to reinvent... Cheers, Sam. -- PHP Internals - PHP Runtime Development

Re: [PHP-DEV] Experiments with a threading library for Zend: spawning a new executor

2011-01-19 Thread Ángel González
On 19/01/11 23:10, Sam Vilain wrote: On 20/01/11 10:17, Ángel González wrote: Have you taken a look at Runkit_Sandbox? It may provide useful tips. *headdesk* No, I hadn't seen that. Thanks for pointing this out, it looks like exactly what I was trying to reinvent... Cheers, Sam. You may

Re: [PHP-DEV] How deep is copy on write?

2011-01-19 Thread Ben Schmidt
On 20/01/11 6:05 AM, la...@garfieldtech.com wrote: So it sounds like the general answer is that if you pass a complex array to a function by value and mess with it, data is duplicated for every item you modify and its direct ancestors up to the root variable but not for the rest of the tree.

Re: [PHP-DEV] Experiments with a threading library for Zend: spawning a new executor

2011-01-19 Thread Stefan Marr
Hi Sam: (becomes off-topic here, but for the sake of argument) On 19 Jan 2011, at 04:14, Sam Vilain wrote: On 19/01/11 10:50, Stefan Marr wrote: On 18 Jan 2011, at 22:16, Sam Vilain wrote: there doesn't seem to be an interpreter under the sun which has successfully pulled off threading

Re: [PHP-DEV] [citations for] Re: [PHP-DEV] Experiments with a threading library for Zend: spawning a new executor

2011-01-19 Thread Martin Scotta
Many PHP features should be language constructs, but they were made as language hacks. __construct is evil, as like any other language hack It does not provides a safe fundation to build safe abstractions, reusable and extendibles components, which leads to the lack of PHP libraries. Let's

Re: [PHP-DEV] [citations for] Re: [PHP-DEV] Experiments with a threading library for Zend: spawning a new executor

2011-01-19 Thread Stas Malyshev
Hi! Many PHP features should be language constructs, but they were made as language hacks. __construct is evil, as like any other language hack Constructors are standard feature in many languages. There's nothing evil in them. class Client { function __construct() { // some

Re: [PHP-DEV] How deep is copy on write?

2011-01-19 Thread Larry Garfield
On Wednesday, January 19, 2011 4:45:14 pm Ben Schmidt wrote: Related: What is the overhead of a ZVal? I'm assuming it's a fixed number of bytes. It seems not, though a zval has a fixed size. What that size is will depend on the compiler and architecture of the system being used, or at