You are here: Re: string concat vs. join/implode « PHP Programming Language « IT news, forums, messages
Re: string concat vs. join/implode

Posted by NoWhereMan on 05/14/07 19:59

On Mon, 14 May 2007 22:14:58 +0300, Rami Elomaa wrote:

> Why don't you benchmark them for comparison? Run both in a loop for
> thousands of times and take time for both and check how much memory they
> consume. You'll need memory_get_usage(), maybe memory_get_peak_usage()
> and microtime().


unfortunately the PHP version I've got here has not been compiled with
memory limits... by the way, I've did this quick and dirty concat vs.
implode test with microtime() only.

concat is generally a bit slower than join when strings are small and
iterations are not many (for instance 10) results are about in the order of
8.5E-5 vs. 6.0E-5 so quite a bit :)

by the way as the number of iterations grows and as the length of the
string grows the results are very comparable, so comparable (almost same
values from 0.00025 to 0.00030) that I think loops must have been optimized
in this sense :)

bye

--
NoWhereMan (e.v.)
-- http://www.nowhereland.it
-- http://flatpress.nowhereland.it

 

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

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