I noticed that a lot of core and non-core developers use technique
Nr. 1 below a lot. And, as far as I read it somewhere, I believe that technique
Nr.2 below is considered to have minor performance boost in php. (It also is a
bit of lesser code).
Technique Nr1: <? echo (some 1 line-php code here) ;?>
Technique Nr2: <?=(some 1 line-php code here)?>
So, isn't is better to adapt this code-guideline and do a regular-expression find-and-replace on the whole joomla code? It might turn out to be a wide performance boost (because it is used so many times).
--
You received this message because you are subscribed to the Google Groups "Joomla! CMS Development" group.
To post to this group, send an email to joomla-...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-cm...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-cms?hl=en-GB.
> Technique Nr1: <? echo (some 1 line-php code here) ;?>
> Technique Nr2: <?=(some 1 line-php code here)?>
The only correct (because independent of individual server
configuration) is a third version:
Technique Nr3: <?php echo (some 1 line-php code here); ?>
Regards,
Niels
On Dec 25, 5:10 am, Niels Braczek <nbrac...@bsds.de> wrote:
> @Niels, careful with using words like "only correct".
I am...
> As you forgot the fourth variation. When the php code are on just a
> single line, you don't need the semi-colon:
> <?php echo (some 1 line-php code here) ?>
Yes, this form exists, but that was not the point. We're talking about
short open tags.
Regards,
Niels
Discussing some 'bad' practices?
Performance boost (while a regular expresssion is sooo fast at all)?
Breaking the compatibility?
Making problems if the directive short_open_tag is DISabled (as it is
on all of my servers)?
Having/making troubles if XML will be used in conjuction with php?
Really see no sense in this discussion - see also http://at2.php.net/manual/en/ini.core.php.
And @Ruby: I do NOT see this technique at many develoepers (and I am
happy about that!), but maybe you can highlight me/this - show me
where in the core is this done (3PD is not from interest for me as
there are too many lousy written scripts out there)?
As I said, our coding style practices are aimed at readability. Yes,
there may be and most certainly are more performant coding styles out
there, but we are talking about the tiniest fractions of performance
improvements, barely measurable. I doubt that we would even register a
1% performance gain in the overall run and if we are talking about a
mission-critical application that actually depends on this <1%
performance gain, I'd say you either are using the wrong tool (or coding
language) or you aren't throwing enough hardware at it.
What I'm saying is: Could we please focus on the big performance drains
in our system and the work that we have to do to get this new version
out to the people?
Hannes
Am 26.12.2009 14:58, schrieb dukeofgaming:
> FTR: The Kohana MVC framework asks for this as a requirement since PHP
> has had this enabled by default for quite some time.
>
> It would be nice that Joomla included an optional survey during the
> installation to find out this kind of stuff
>
> On Sat, Dec 26, 2009 at 5:37 AM, mic <michael...@gmail.com
> <mailto:michael...@gmail.com>> wrote:
>
> I am not shure what for this thread shall be good?
>
> Discussing some 'bad' practices?
> Performance boost (while a regular expresssion is sooo fast at all)?
> Breaking the compatibility?
> Making problems if the directive short_open_tag is DISabled (as it is
> on all of my servers)?
> Having/making troubles if XML will be used in conjuction with php?
>
> Really see no sense in this discussion - see also
> http://at2.php.net/manual/en/ini.core.php.
>
> And @Ruby: I do NOT see this technique at many develoepers (and I am
> happy about that!), but maybe you can highlight me/this - show me
> where in the core is this done (3PD is not from interest for me as
> there are too many lousy written scripts out there)?
>
>
> On Dec 25, 3:08 pm, Niels Braczek <nbrac...@bsds.de
> <mailto:nbrac...@bsds.de>> wrote:
> > Stian Didriksen schrieb:
> >
> > > @Niels, careful with using words like "only correct".
> >
> > I am...
> >
> > > As you forgot the fourth variation. When the php code are on
> just a
> > > single line, you don't need the semi-colon:
> > > <?php echo (some 1 line-php code here) ?>
> >
> > Yes, this form exists, but that was not the point. We're talking
> about
> > short open tags.
> >
> > Regards,
> > Niels
>
> --
>
> You received this message because you are subscribed to the Google
> Groups "Joomla! CMS Development" group.
> To post to this group, send an email to
> joomla-...@googlegroups.com
> <mailto:joomla-...@googlegroups.com>.
> To unsubscribe from this group, send email to
> joomla-dev-cm...@googlegroups.com
> <mailto:joomla-dev-cms%2Bunsu...@googlegroups.com>.
@mic please know what you're talking about before critiquing. The
regular expressions are only applied when the server does not support
shortags. It's in the Nooku fw used for template layouts not for
performance reasons (there are other far more better areas to look at
in your code to improve that, like improving your queries, use caching
and more) it's mostly for code readability for the files that regular
users and more novice developers are most likely to make changes to
the code. Most people only want to modify the html output of the
extension a little bit, and in those files using shortags really makes
things a lot cleaner and simpler. And the regular expressions keeps
compatibility intact.
But if Joomla where to adopt this pattern from the Nooku FW. Now is
not a good time. It would require a lot of changes to the template
parsing code, and is something more suitable for 1.7 and 2.0.
I, like most devs, thinks the best thing to do for 1.6 now is to just
stick to the roadmap and don't let the feature creep take over :)
Cheers,
Stian Didriksen
short_open_tag
Default : "1"
Changeable: PHP_INI_ALL
Changelog: PHP_INI_ALL in PHP <= 4.0.0. PHP_INI_PERDIR in PHP < 5.3.0
Kinf off topic, but:
What about the following as bigger performance boost (maybe still not
big enough for you, but I'll wager it).
I haven't had any reaction to it, but I do mean if we would use the
presented technique in that post on many other places.
http://groups.google.com/group/joomla-dev-cms/browse_thread/thread/41c5a90404361045
> Breaking the compatibility?
Which others then the ones you repeat here?
> Making problems if the directive short_open_tag is DISabled (as it is on all of my servers)?
Well, if performance would be relevant enough (which by now some say
it is negligable) and since the documentation of php says it's ENABLED
by default, I can only say: No pain, no gain.
> Having/making troubles if XML will be used in conjuction with php?
There is a very small workaround for this, and since there is much
less XML where it would be needed than all the 1001 places where
technique Nr.3 is used, this would be of no real importance. But
small, good point nevertheless. I did'tn pay attention to it before.
> Really see no sense in this discussion - see alsohttp://at2.php.net/manual/en/ini.core.php.
Am I missing something? It says "1" by default, which means ENABLED,
not?
> And @Ruby: I do NOT see this technique at many develoepers (and I am
> happy about that!), but maybe you can highlight me/this - show me
> where in the core is this done (3PD is not from interest for me as
> there are too many lousy written scripts out there)?
Sorry, my bad, see my previous answer about this (my faulty Nr.1
should actually be Nr. 3 by Niels)
-Joe
You bring up an interesting point. Some people do not know the Joomla!
coding standards and it might be a good idea to point them in the
right direction for documentation on this so that they know the
Joomla! way.
Kindest regards,
--Steven Pignataro
+1 on that last sentence. Someone from Zend was explaining this to me
several years ago, and I managed to forget the reason, but remember
the sentiment (short tags are a bad idea in general). *blush*
This is a pretty big deal and is the primary argument for the
anti-shorttag folks.
-- Mitch