Re[4]: [PEAR-DEV] [PEPr] +1 for XML::XML_Feed_Parser
| From: | techtonik | Date: | Fri, 28 Oct 2005 20:26:05 +0000 |
| Subject: | Re[4]: [PEAR-DEV] [PEPr] +1 for XML::XML_Feed_Parser | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-40331@lists.php.net to get a copy of this message | ||
||*()*|| [\..konnichi wa, ogenki desu ka, Justin../]
>> JP> And may I point out that I *always* say that I *prefer* single quotes,
>> JP> not they the developer *must* use them.
>>
>> But don't you find it annoying to always say the same thing? =)
JP> Yes, but what I'm doing is helping people be better PHP developers.
I thought better PHP developers should be comfortable with any syntax. =)
>>
>> As for your script - the worst scenario I can get is 10% difference on
>> single $ included in both strings resulting in a 0.5 seconds delay on a
>> 100000 lines script. Considering real working script even in this
>> worst (and unrealistic) scenario the ratio of overall execution time to
>> this stuff would be at least hundred to one. Even if you try to
>> multiply this 0.5s by amount of simultaneous script executions (the
>> same hundred, for example) to get some real grounds for this kind of
>> recommendations - on realistic script your server will be drop dead long
>> ago until you reach this limit. =) So the main point is what this stuff
>> just doesn't worth developer's time.
>>
JP> I didn't say it was a huge difference. The difference between $a++ and
JP> ++$a is also not that big, but it makes a difference. Add up all the
JP> little tricks and you can get significant speedups. At least I have
JP> shown, for all to see, that what I've been saying is true (although I
JP> shouldn't have had to since other well-known developers also vouched
JP> for this and you should have been able to test it yourself as well).
Ok. Show me a real life application, where these tricks helped to gain
performance and notably reduce server load?
JP> And you're still ignoring that concatenation is easier to audit. *All*
JP> syntax highlighters will highlight concatenation. Only some highlight
JP> in-string vars correctly. Besides that, it's also simpler to be able
JP> to skip over single quoted vars when looking for things like XSS or
JP> SQL injection attacks. It also means that there are no special chars
JP> in the string to watch out for.
I'm not ignoring concatenation - I've already explained the POV what
it is harder to audit concatenation instead of in-lines. =) And if
your PHP editor doesn't support in-line highlighting then it is not
a PHP editor and it will not help you anyway.
JP> Using " is also more error-prone when dealing with complicated vars
JP> (and it can't be used for *really* complicated ones). On top of this
JP> it tends to promote bad array syntax ($arr[key] instead of
JP> $arr['key']).
We all prefer easy syntax, so let's not speak about exclusive hacks
and those, who tend to use complicated vars.
JP> For all of these reasons (and probably some I'm missing) ' should be
JP> preferred over ".
Ok. I reasonably do not agree with your reasons and prefer double
quotes over single ones. Should we try to convince users harder and
place a voting through proposal to establish democratic truth by
getting 51% of votes and make this into CS? =)
WBR.techtonik
--
(B)uilding, (A)ntenna, (S)pan and (E)arth
* terminal velocity - 54m/s, 305m *