[pmwiki-users] Automatic linking
Joachim Durchholz
jo at durchholz.org
Fri Feb 17 06:37:41 CST 2006
Karl Loncarek schrieb:
> Joachim Durchholz <jo at durchholz.org> wrote:
>
>>Karl Loncarek schrieb:
>>
>>>Creation of a page takes around 0.4 seconds longer with this script
>>>activated.
>>
>>I'd consider that too much: 0.4 seconds will noticeably add to the
>>usual network delays. In a LAN, even 0.1 seconds would be noticeable
>>and "too slow".
>>Of course, a lot depends on the machine that's doing the operations,
>>so those 0.4 seconds aren't necessarily too slow for everybody. Still,
>>0.4s seems like there are some algorithmic inefficiencies in the code
>>(such as adding to an array one entry at a time, or reading all
>>existing page files for each update).
>>
> Well maybe, when I officially released it you are welcome to look at the
> ode and give hints efficient code or change it on your own.
Will give hints. No time to actually rework the code, alas - too busy
relocating, updating Debian installations, and getting at some income.
> In fact I was searching the web to get some information which PHP
> commands are faster than others.
Most speed comparisons that you can find on the net are irrelevant - in
the range of milliseconds.
Building a string of N parts by appending piece by piece takes O(N*N)
time. That's why fast code first places those N parts in an array first
via the $my_array[]=whatever mechanism, (that's a log(N) operation I
think), then implode()s the array. This give a total time of O(NlogN),
which is practically indistinguishable from O(N).
Another thing to avoid is to read all files to build something. That's a
good way to build a mechanism that won't scale.
> Nevertheless I'll try to isolate parts of the code that take long.
That would be a tremendous help in spotting the actual problems.
> At first I wanted a working version. Now I can go through the source and
> try to optimize stuff.
Good approach.
Regards,
Jo
More information about the pmwiki-users
mailing list