You are here: Re: Change alternate commas to semi colons... « PHP Programming Language « IT news, forums, messages
Re: Change alternate commas to semi colons...

Posted by Rik on 06/21/06 21:25

Andy Jeffries wrote:
> On Wed, 21 Jun 2006 13:48:00 +0200, Rik wrote:
>>> It is to me, I'd always thought regexs were slower. Bugger, that
>>> means I will /really/ have to get round to learning them.
>>
>> Yup, I'm quite capable to produce some regexes, but in all testcases
>> I saw where it could be done without, regexes seemed slower... Time
>> to test some past code.
>
> I always prefer them as it's generally a lot more readable (a single
> line of code compared to 10 lines of iteration). In most cases
> developer comprehension is more important than CPU cycles (unless
> you're working
> with masses of data, but that's not normal in a web system).

It's true that most often it's not the bottleneck. Opening files/databases
etc. are usually terrible more consuming (hey, there is a reason why we had
to loop this code 5000 times to get a reasonable result to compare.
Nevertheless, iot never hurts to make is as efficient as possible.

> The obvious comment coming is "regexes are more readable, what a load
> of BS" - but they are if you understand regexes, and if you don't -
> it's not my fault you are lacking in a skill (with "you" being the
> developer coming to look at my code for maintenance).

Regexes can be perfectly commented, which is rarely used unfortunately.
Using /x to newline/indent (and thus make a regex more readable) should also
be used more often. Then, instead of 1 line >400 characters long with some
code you've got a nice regex that you comprehend in a lot less time. No more
searching for the opening or closing parenthesis.

Grtz,
--
Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация