 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Sara Golemon's Blog: How long is a piece of string?
by Chris Cornutt June 19, 2006 @ 05:56:03
Sara Golemon, inspired by an IRC discussion has gathered together some of her thoughts on "using PHP's string interpolation without using an optimizer".
She explains how a simple string (an echo statement) is interpreted into a simple compilation structure. Her next step, though (placing a variable inside a string) yields something that seems more complex than it should be. A concatination example simplifies things down a bit, but, oddly enough, it gets even better when a comma is used instead of a period to concatinate. She also gives an example of a heredoc statement that doesn't conform to the interpolation standards you'd think.
Why does this happen? Because there are about a dozen ways that a variable can be hidden inside an interpolated string. Similarly, when looking for a heredoc end-token, the token can be an arbitrary length, containing any of the label characters, and may or may not sit on a line by itself. Put simply, it's too difficult to encompass in one regular expression.
She specifically mentions the APC caching system and its built-in optimizer to help with some of these issues. It pulls the interpolations back down to a size they should be and anticipating operations by pre-resolving things like constants and scalar expressions.
Of course, not everyone can install this pacakge, so she suggests an alternative:
You can still avoid 90% of the INIT_STRING/ADD_STRING dilema by simply using single quotes and concatenation (or commas when dealing with echo statements). It's a simple trick and one which shouldn't harm maintainability too much, but on a large, complicated script, you just might see an extra request or two per second.
voice your opinion now!
internals string concatination opcodes period comma heredoc apc internals string concatination opcodes period comma heredoc apc
Helgi's Blog: Clash of the Titans
by Chris Cornutt November 30, 2005 @ 07:38:56
From Heigl's blog today, there's his look at some of the issues that surrounded the release of PHP 5.1.0 (and the quick following of PHP 5.1.1).
As many have noticed 5.1.0 had some issue when it was released, like for starters it introduced a empty date class by default which effectively killed scripts that used PEAR::Date.
As one can see in this excellent rant by Ilia there are different views on how this should have been handled (also read the internals ML if you need even more reading material), namely why PEAR was polluting generic names and why they didn't fix it right away so PHP could get the glorious name of Date.
Heigl takes the side of the internals developers, that internal PHP should win out over PEAR on this issue. There's been a pretty large debate raging on about this one - and, even with the (pullback) release of PHP 5.1.1, it goes on as an issue to address in, say, PHP 5.2? (Or maybe they'll just wait until 6 and lump it all in...)
voice your opinion now!
php internals date class pear debate php internals date class pear debate
Andrei Zmievski's Blog: This Is Not "American Idol"
by Chris Cornutt November 30, 2005 @ 07:06:22
In this new post from Andrei Zmievski's blog today, he has a bit of a reminder for anyone out there participating in the php-internals mailing list - "don't forget to participate".
The latest round of discussions on the php-internals mailing list highlights something that has been a pet peeve of mine for a long time. As PHP became more and more popular, the number of people subscribed to the mailing list has grown as well, and lately this has resulted in a slew of interminable threads of will-crushing length.
A whole lot of these folks are under the impression that one can simply subscribe to the list, read discussions while lurking or semi-lurking, and start to vote on things that affect intimate parts of the language. That is... kind of gall-ish, if you ask me.
His recommendation so that you will be taken seriously (and have your opinion count) on the list? Participate - good, valid, throughtful participation - that contributes a full and complete thought to the conversation on the list. And no, "+2 for namespaces" doesn't count...
voice your opinion now!
php internals mailing list american idol php internals mailing list american idol
|
Community Events
Don't see your event here? Let us know!
|