|
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]
|