>> I still want to keep the performance implications in mind, as this
>> sounds like something that we'd want to use a lot but could also cost a
>> lot more than it seems at first glance if we're not careful.
>
> By making properties in memory a little bigger one might write the
> accessors in the same table as the actual properties one might possibly
> reduce the CPU requirement abit. While one has to touch most places
> dealing with properties internally (while that's probably needed
> anyways). But well, unless there is an implementation all performance
> ideas are guesses ... educated guesses at best.


Just to chime in on the subject of performance, here is how C# handles
properties:

When compiling, C# simply creates a normal class method for both the get
and set method in a property.  So basically, the "property" ceases to
exist, and is replaced with two plain methods.  These methods are either
in their own namespace (or more likely) use a name that is not valid or
possible in C# itself.

After that, all calls to the property are replaced with calls to the new
methods.  Because of this, properties have no greater overhead than
methods do, which is exactly what we want, since properties are meant to
replace getter and setter methods.

How much this informs performance in PHP, I do not know.

- Dennis


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

Reply via email to