Re: [PHP-DEV] [VOTE] Vote change for empty() RFC

2012-05-22 Thread Rafael Dohms
Awesome, that clear is up pretty well.

I  just wanted to get this well cleared up, and since this vote ad its various
quirks, why not just sort out all issues once and for all.

Thanks for the replies.

-- 
Rafael Dohms
PHP Evangelist and Community Leader
http://www.rafaeldohms.com.br
http://www.phpsp.org.br

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [VOTE] Vote change for empty() RFC

2012-05-22 Thread Pierre Joye
hi Lars,

On Mon, May 21, 2012 at 10:36 PM, Lars Strojny l...@strojny.net wrote:
 Hi Rafael,

 hope it’s ok I've reopened the vote temporarily, but you’ve got the missing 
 vote.

You have what? That's not that ok actually

Cheers,
-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] memory usage ouchy

2012-05-22 Thread Tom Boutell
Actually, I just updated Rasmus' demo program to use assocative arrays
instead of objects.

In PHP 5.4.x, the associative array version uses more memory than the
object oriented version.

That's because PHP 5.4.x is using a flat array for predeclared
properties, as was mentioned earlier by Gustavo.

Associative arrays:

524288 bytes

Objects:

262144 bytes

The object-oriented version is also faster, by about 20%.

Interestingly these results don't change much if I make the property
names/keys much shorter. Probably there's a minimum allocation of 64
bytes for these or something.

It would appear there is no longer a penalty simply for using many
objects vs. many associative arrays in PHP 5.4. The opposite, in fact.
I'm sure arrays didn't get slower, but objects now take advantage of
some optimizations that become possible when properties are
predeclared.

However this doesn't mean that calling lots of setters will
necessarily be as fast as direct property access... oh what the heck,
let's test that too:

Calling dead-simple setters for the four properties rather than
setting them directly slows down the OOP version to the point where it
runs at just about the same speed as the associative array version.
That's not terrible. Direct property access is still fastest (after
all that's what the setters do after they pay the overhead of the
function call).

On Mon, May 21, 2012 at 9:23 PM, Richard Lynch c...@l-i-e.com wrote:
 No offense intended, but if you've got so many OOP objects flying
 around that they are sucking down that much memory...

 You probably need to refactor your code and just don't do that

 Just my opinion.

 --
 brain cancer update:
 http://richardlynch.blogspot.com/search/label/brain%20tumor
 Donate:
 https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclickhosted_button_id=FS9NLTNEEKWBE



 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Re: [VOTE] Vote change for empty() RFC

2012-05-22 Thread Richard Lynch
On Sun, May 20, 2012 5:44 pm, Pierre Joye wrote:
 On Sun, May 20, 2012 at 11:03 PM, Rafael Dohms
 lis...@rafaeldohms.com.br wrote:
 On Mon, May 14, 2012 at 1:16 PM, Anthony Ferrara
 ircmax...@gmail.com wrote:

 I had meant to reply to the list, but I had replied to Stas
 directly.
 I would be happy to change my vote from isset() and empty() to
 empty()
 only if that's what it would take...

 Anthony

 This would settle it, so in the realm of action what can we do
 now?
 Is there a rule that allows to call for a re-vote?
 Should start a new RFC?
 Or can we just alter the vote and consider this the end of voting?

 Sorry, but all this talking is running around in circles, and
 everything has been said. I would like to bring closure to this
 topic.

 See the previous mails, as long as other voters agree to change their
 votes to empty only, we are done.

I had voted none.

I really don't care about empty, because it has changed edge cases in
every major release, so I can't use it.

Therefore and herewith, I officially change my none vote to empty
only

Please put a fork in it and call it done.

-- 
brain cancer update:
http://richardlynch.blogspot.com/search/label/brain%20tumor
Donate:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclickhosted_button_id=FS9NLTNEEKWBE



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] 2/3 = ??? Re: [PHP-DEV] [VOTE] Vote change for empty() RFC

2012-05-22 Thread Richard Lynch
On Mon, May 21, 2012 5:22 pm, Sanford Whiteman wrote:
 Ah, this is why one should trust a coder over a butler:

 http://www.ask.com/answers/112530521/5-people-are-voting-what-is-2-3-s-of-a-majority

Regarding the 2/3 super-majority rule...

I thought I'd check the non-authorative but always interesting
wikipedia article...

Apparently, we are not the only ones confused by edge cases:

http://en.wikipedia.org/wiki/Supermajority

-- 
brain cancer update:
http://richardlynch.blogspot.com/search/label/brain%20tumor
Donate:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclickhosted_button_id=FS9NLTNEEKWBE



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] php interpreter

2012-05-22 Thread Richard Lynch
On Wed, May 9, 2012 5:05 pm, Xin Tong wrote:

 I am new to php runtime. i am doing some research on runtime
 interpreter. can anyone please tell me where the interpreter of the
 php runtime is ? which file ? and does the php runtime has a JIT
 compiler ?

I believe the interpreter is built out of bison/yacc files, so you
could start with those to find out where they put it.

The php runtime is a JIT parser/compiler to a bytecode, which is then
run by the Zend Engine (see above).

Actually, that last statement might imply the the zend directory would
also be a good place to look.

Finally, it should be noted that APC and other caching mechanisms save
a great deal of time by not hitting the disk to load the script, but
keeping it in RAM, if possible.

As gravy on top of that, the bytecode is saved in cache instead of
source, so it is not a JIT if one of those caches is in use.

Psuedo code to describe the difference the APC (or other cache) makes:


//save hitting the hard disk
if ( $source_code = in_cache($path)){
}
else{
  //super-duper slow!!!
  $source_code = file_get_contents($path);
}
$bytecode = zend_parse($source_code);
zend_execute($bytecode);

//save hitting the hard disk
//and a small bonus, cache the bytecode, not source:

if ($bytecode = in_cache($path)){
  //do nothing
}
else{
  $source_code = file_get_contents($path);
  $bytecode = zend_parse($source_code);
}
zend_execute($bytecode);


The savings from parsing is chump change compared to disk I/O.

It's also trivial chump change to implement.

Ever ounce counts :-)

-- 
brain cancer update:
http://richardlynch.blogspot.com/search/label/brain%20tumor
Donate:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclickhosted_button_id=FS9NLTNEEKWBE



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] APC benchmark

2012-05-22 Thread Mohammad Saleh

All,

I was looking for a standard benchmark script that I could run with and without 
apc caching to see the general gains.
Is there something that is used by the internals team for such tests?
If not, are there any recommendations?


Thanks,
Mohammad
  

Re: [PHP-DEV] APC benchmark

2012-05-22 Thread Tom Boutell
You might be better off testing a nontrivial case like a framework
based web application's homepage with and without APC turned on for
100 fetches. That's where APC really shines.

On Tue, May 22, 2012 at 11:18 AM, Mohammad Saleh msaleh...@hotmail.com wrote:

 All,

 I was looking for a standard benchmark script that I could run with and 
 without apc caching to see the general gains.
 Is there something that is used by the internals team for such tests?
 If not, are there any recommendations?


 Thanks,
 Mohammad




-- 
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DEV] APC benchmark

2012-05-22 Thread Mohammad Saleh

Thank you for the feedback Tom.

I actually created a simulated test with jmeter and wordpress and was testing 
that with and without apc (simulation of a set of authors and readers).
Once I turned on APC, I realized my db server became a bottleneck and I was not 
able to test the max throughput.

Your scenario removes the db and focuses strictly on the cached pages, so I 
will give that a try.

Thanks and if there are any other suggestions, please do let me know!

- Mohammad

 Date: Tue, 22 May 2012 11:38:56 -0400
 From: t...@punkave.com
 To: internals@lists.php.net
 Subject: Re: [PHP-DEV] APC benchmark
 
 You might be better off testing a nontrivial case like a framework
 based web application's homepage with and without APC turned on for
 100 fetches. That's where APC really shines.
 
 On Tue, May 22, 2012 at 11:18 AM, Mohammad Saleh msaleh...@hotmail.com 
 wrote:
 
  All,
 
  I was looking for a standard benchmark script that I could run with and 
  without apc caching to see the general gains.
  Is there something that is used by the internals team for such tests?
  If not, are there any recommendations?
 
 
  Thanks,
  Mohammad
 
 
 
 
 -- 
 Tom Boutell
 P'unk Avenue
 215 755 1330
 punkave.com
 window.punkave.com
 
 -- 
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php
 
  

Re: [PHP-DEV] APC benchmark

2012-05-22 Thread Tom Boutell
Including Wordpress in your test does sound fairly realistic actually,
but it's a good sign that something else becomes the bottleneck with
APC enabled (:

On Tue, May 22, 2012 at 12:46 PM, Mohammad Saleh msaleh...@hotmail.com wrote:
 Thank you for the feedback Tom.

 I actually created a simulated test with jmeter and wordpress and was
 testing that with and without apc (simulation of a set of authors and
 readers).
 Once I turned on APC, I realized my db server became a bottleneck and I was
 not able to test the max throughput.

 Your scenario removes the db and focuses strictly on the cached pages, so I
 will give that a try.

 Thanks and if there are any other suggestions, please do let me know!

 - Mohammad

 Date: Tue, 22 May 2012 11:38:56 -0400
 From: t...@punkave.com
 To: internals@lists.php.net
 Subject: Re: [PHP-DEV] APC benchmark


 You might be better off testing a nontrivial case like a framework
 based web application's homepage with and without APC turned on for
 100 fetches. That's where APC really shines.

 On Tue, May 22, 2012 at 11:18 AM, Mohammad Saleh msaleh...@hotmail.com
 wrote:
 
  All,
 
  I was looking for a standard benchmark script that I could run with and
  without apc caching to see the general gains.
  Is there something that is used by the internals team for such tests?
  If not, are there any recommendations?
 
 
  Thanks,
  Mohammad
 



 --
 Tom Boutell
 P'unk Avenue
 215 755 1330
 punkave.com
 window.punkave.com

 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] 2/3 = ??? Re: [PHP-DEV] [VOTE] Vote change for empty() RFC

2012-05-22 Thread Kris Craig
On Tue, May 22, 2012 at 11:51 AM, Sanford Whiteman 
swhitemanlistens-softw...@cypressintegrated.com wrote:

  Apparently, we are not the only ones confused by edge cases:

  http://en.wikipedia.org/wiki/Supermajority

 Can you point to where there's any suggestion of using the ceiling
 (rounding up) instead of requiring whole persons? In fact, the
 Wikipedia page matter-of-factly says ...two thirds (currently 34) of
 the states

 -- S.


I'm not sure I understand where the conflict is.  2/3 * 50 == 33 1/3.
 Therefore, 33 states would be just below the required 2/3, while 34 states
would be just above it.  So the 34 figure you quoted seems to match this
perfectly.

The article does mention some ambiguity, but that's pertaining to whether
the total includes everyone who *can* vote or just everyone who *did*
vote.  As far as I know, that's not relevant to this discussion.

--Kris


Re: [PHP-DEV] 2/3 = ??? Re: [PHP-DEV] [VOTE] Vote change for empty() RFC

2012-05-22 Thread Sanford Whiteman
 I'm not sure I understand where the conflict is.  2/3 * 50 == 33 1/3.
  Therefore, 33 states would be just below the required 2/3, while 34 states
 would be just above it.  So the 34 figure you quoted seems to match this
 perfectly.

 The article does mention some ambiguity, but that's pertaining to whether
 the total includes everyone who *can* vote or just everyone who *did*
 vote.  As far as I know, that's not relevant to this discussion.

I agree, don't see any relevant edges.

From what I can see in the bylaws for writing bylaws world, it is
understood that you must have whole persons unless you *specifically*
make an exception that you will use the ceiling.

-- S.


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] 2/3 = ??? Re: [PHP-DEV] [VOTE] Vote change for empty() RFC

2012-05-22 Thread Richard Lynch
On Tue, May 22, 2012 1:51 pm, Sanford Whiteman wrote:
 Apparently, we are not the only ones confused by edge cases:

 http://en.wikipedia.org/wiki/Supermajority

 Can you point to where there's any suggestion of using the ceiling
 (rounding up) instead of requiring whole persons? In fact, the
 Wikipedia page matter-of-factly says ...two thirds (currently 34) of
 the states

I should have been more clear:

Whether that article addresses rounding up, down or sideways, it's an
awfully long article for what should be a fairly simple thing...

I know I started zoning out long before the halfway mark.

I certainly didn't do the math for every example from every
country/quorum/entity...

Actually, if we used the abstain == no logic of some bodies, I don't
think any of our RFCs would pass :-)

-- 
brain cancer update:
http://richardlynch.blogspot.com/search/label/brain%20tumor
Donate:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclickhosted_button_id=FS9NLTNEEKWBE



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] 2/3 = ??? Re: [PHP-DEV] [VOTE] Vote change for empty() RFC

2012-05-22 Thread Sanford Whiteman
 Whether that article addresses rounding up, down or sideways, it's an
 awfully long article for what should be a fairly simple thing...

It does seem long-winded toward the top. I guess it's notable that in
all that text, it doesn't even note the floor/ceiling concept. I
interpret the absence as because it's obvious, but you could argue
(given the inanity of the Ask.com answers) that isn't obvious enough
to be left out of the 'pedia of record. Maybe someone on Internals
is also an active Wiki editor.

-- S.


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Catchable - marking methods just like static?

2012-05-22 Thread Richard Lynch
On Tue, April 3, 2012 9:02 pm, Alan Knowles wrote:
 I just saw Daniel changing some of the PEAR classes to use Exceptions,
 and it's pretty clear that this could cause havoc with the end users.
 The problem being that there is no 'soft' landing for the migration
 process.

If I understand set_exception_handler correctly, you could simply make
anything that reaches that state simply not return at all, and exit.

If you are that serious about the problem, the code expecting a result
and not an exception won't get anything at all.

And code with proper exception handling will do the right thing,
assuming you have written all your exception handlers at every layer
correctly.

Personally, try/catch and throw always felt like GOTO to me, and the
larger the codebase, the harder I found it to track down who was the
thrower and who was the catcher.

Reminded me of the old Abbot and Costello baseball routine.

-- 
brain cancer update:
http://richardlynch.blogspot.com/search/label/brain%20tumor
Donate:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclickhosted_button_id=FS9NLTNEEKWBE



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] php interpreter

2012-05-22 Thread Stas Malyshev
Hi!

 I am new to php runtime. i am doing some research on runtime
 interpreter. can anyone please tell me where the interpreter of the
 php runtime is ? which file ? and does the php runtime has a JIT
 compiler ?

PHP compiles source code into Zend Engine bytecode - this is done by the
compiler in zend_language_scanner.l, zend_language_parser.y and
zend_compile.c. This code is the executed by the opcode engine in
zend_execute.c and zend_vm_execute.h. The latter is generated from
zend_vm_def.h by means of the script zend_vm_gen.php.

-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php