Skip to main content

Performance question

More
12 years 2 months ago #119 by mackelito
Just querious about performance.

$item=str_replace(array('word'),array(''),$item); $item=str_ireplace("word","",$item);
$item=str_replace("word","",$item);

Will there be any performance difference with these?

Please Log in to join the conversation.

More
12 years 2 months ago #124 by redactie
Replied by redactie on topic Re: Performance question
Damn,

wrote quite a reply on this topic, but somehow it got lost.

There are differences in performance, str_ireplace is slower as str_replace and passing arrays is slower then passing strings. However when doing a lot of replaces the array gets faster.

However the str_replace is not the main bottleneck. I didn't really profile the scripts so I don't know the exact usage of each part but I'm sure database operations are a big consumer

Please Log in to join the conversation.

Time to create page: 0.399 seconds