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 Andy Jeffries on 06/21/06 13:08

On Wed, 21 Jun 2006 13:32:50 +0200, Rik wrote:
>>> So, the preg version absolutely whips the function call (completes in
>>> 24% of the time).
>>>
>>> As much as I'd advocate testing over guesswork, I agree with your
>>> understanding of why it's much faster.
>
> Yup, I should've tested it, somtimes lazyness will make you look like a
> fool
> :-)

I agree with your sentence, but don't think it's the case here - your
regex is still the fastest on the block! And it's provoked an interesting
discussion (and maybe given a few people reason to eventually learn
regexes).

>> Can you run the same test with this code:
>
> Does it in 6.8535070419312

Using my machine (for comparison with all the previous timings):

1.8554 seconds (with correct output).

>> Usually I would use strpos for this sort of thing, which could be even
>> faster, since it will shorten the looping in php, but still would depend
>> on how well php does it.
>
> strpos() example:
>
> This manages it in 2.1639029979706

I make it: 0.5243 seconds (within a margin of error the same as Juliette's
bit testing version, but with the correct output).

Cheers,


Andy

--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

 

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

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