FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » General » PHP discussions » Brain deadness of PHP
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Brain deadness of PHP [message #2119] Wed, 01 May 2002 01:43 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma:
Senior Member
Administrator
Core Developer
"substr_replace" function was introduced a while back into PHP, in theory it is a wonderful function that allows the user to replace a section of the string with another.

Well, today while coding FUDcode parser, I decided to use that function , I should've known better.

After spending over 1 hour trying to trace the reason behind the slowness of my code I found out that substr_replace function is EXTREMLY slow and becomes exponentially slower as the string size increases. Now the "funny" part using php code I was able to write the same function which was in excess of 100% faster!!!!
This should give you some idea as to how badly that function is written, since it is written in C and not PHP, hence should be @ least 10 times faster then anything I write in PHP.

</rantoff>

Moral of this story, DO NOT use substr_replace!


FUDforum Core Developer
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: ob_start, ob_gzhandler
Next Topic: Differences in the definition of a string.
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Dec 01 10:53:43 GMT 2024

Total time taken to generate the page: 0.04452 seconds