Reply to Re: string concat vs. join/implode

Your name:

Reply:


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

On 14 May 2007 12:05:10 -0700, frugalprogrammer wrote:

> I would say probably not, as (1) is touching each element n times,
> whereas (2) is most likely n*ln(n) in the best case. For i=10, it'll
> double. implode() probably just runs your (1) again, appending each
> element. I'm not entirely sure how the GC operates in PHP or what kind
> of performance hit you might take, but it seems like copy-on-write
> could make dereference in (1) not happen as often as you may think.

interesting, so definitely not a totally stupid one :)

well IIRC I read something about using .join() instead of += in a guide
about optimizing JavaScript (this applies to Java as well, though); I
thought it could be applied to PHP too.

But maybe that involved just single character or number concats

thank you

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

[Back to original 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

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