Re: PHP functions to convert markup efficiently [message #183817 is a reply to message #183816] |
Thu, 21 November 2013 20:18 |
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
|
|
|