Re: [RFC] Propety Accessors v1.1

From: Date: Mon, 08 Oct 2012 12:50:14 +0000
Subject: Re: [RFC] Propety Accessors v1.1
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-63280@lists.php.net to get a copy of this message
Good work Clint! Performance is probably one of the things people will complain about so it's good that your benchmark is proving that it's merely identical to the old __get() approach. What remains on your TODO list for this functionality? When are you planning to run an RFC vote on this? I think this would be a valuable addition to PHP 5.5. Cheers, Paul. On Mon, Oct 8, 2012 at 1:42 PM, Clint Priest <cpriest@zerocue.com> wrote: > As an update, just ran some performance testing: > > master > Cycles Direct Getter __get > v1.4 @ 10/8/2012 1m .05s .21s .20s > > php 5.5.0-dev > Cycles Direct Getter __get > v1.4 @ 10/8/2012 1m .04s n/a .21s > > Performance of property accessors was important to me as I'm sure it will be to many, on > one million cycles of a simple getter, it's <.01s difference. Depending on the run it is > sometimes exactly the same performance. > >> -----Original Message----- >> From: Clint Priest [mailto:cpriest@zerocue.com] >> Sent: Monday, October 08, 2012 6:53 AM >> To: internals@lists.php.net >> Subject: [PHP-DEV] [RFC] Propety Accessors v1.1 >> >> It's been a while since I posted any updates about this, a few individuals have been >> asking about it privately and wanting me to get it >> out the door for PHP 5.5 release. It's come a long way since the last time I posted >> about it. >> >> RFC Document: >> https://wiki.php.net/rfc/propertygetsetsyntax-as-implemented >> >> Example Usage: >> >> class TimePeriod { >> private $Seconds = 3600; >> >> public $Hours { >> get { return $this->Seconds / 3600; } >> set { $this->Seconds = $value; } >> isset<http://www.php.net/isset> { return >> isset<http://www.php.net/isset>($this->Seconds); } >> unset<http://www.php.net/unset> { >> unset<http://www.php.net/unset>($this->Seconds); } >> } >> } >> >> Changes / Updates >> >> * isset/unset accessor functions now implemented (object & static context, auto >> implementations, etc) >> >> * static accessor now fully functional >> >> * Reference functionality validated, tests written >> >> * All operators have been tested, tests written >> >> * read-only and write-only keywords: Added explanation of reasons for inclusion at >> the top of the appropriate RFC section >> >> * Tested for speed, approaches or meets __get() speed. >> >> Internally things have changed quite a bit >> >> * cleaned up and simplified >> >> * had been using 4 to 5 additional fn_flag slots, now down to two (READ_ONLY and >> WRITE_ONLY) >> >> * the automatic implementations now compiled internal php code, this greatly >> simplified that part of the code and future proofed >> it. >> >> The code is available at the url below and is up to date with master, all tests pass. >> https://github.com/cpriest/php-src >> >> I'd like to get this project wrapped up in time to make it to the 5.5 release, only a >> few things remain to be completed/updated: >> >> * Check on reflection code written prior to major changes (tests still pass) >> >> * Add a few more reflection functions that were requested >> >> In total there are 79 tests for this new functionality, if there are any others that I have >> missed, please let me know. >> >> -Clint > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.internals (#63280) next »