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

Home » Imported messages » comp.lang.php » PHP functions to convert markup efficiently
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: PHP functions to convert markup efficiently [message #183817 is a reply to message #183816] Thu, 21 November 2013 20:18 Go to previous messageGo to previous message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma:
Senior Member
James Harris wrote:

>>>> > Of course, implemenations may differ slightly but, on average, are
>>>> > >>>> there
>>>> > >>>> certain PHP approaches that could be expected to be faster than others?
>>>
>>> Most likely those which are programmed in C.
> Is there a way to identify those?

The core of PHP and all bundled extensions are written in C, as well as
all PECL packages. PEAR packages and many other libraries are
programmed in pure PHP.

> That may not be the only consideration. ISTM that even if the regular
> expression handler is programmed in C simple string handling (hopefully also
> programmed in C) should be much faster as long as it is written sensibly.

Of course, a strpos() is faster than an respective preg_match(), but
simple string functions are not as powerful as regular expressions, and
so the number of times they have to be called will sum up. Scanning
character by character, however, might involve a lot of conditional
statements. However, the perfomance might not matter for relatively
small texts at all.

--
Christoph M. Becker
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: changing iframe source via php
Next Topic: converting numbers to ascii values
Goto Forum:
  

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

Current Time: Sun Nov 03 13:02:53 GMT 2024

Total time taken to generate the page: 0.03267 seconds