blog. XODA

System commands vs. native PHP-functions, Part II. (xoda-0.4.3)


XODA-0.4.1 was released after rewriting some system functions using native PHP-code. Benchmarking some native PHP-functions against their system counterparts showed that the native ones work faster. This gave me the motivation to do the (at least partial) switch.

Now I was thinking about going on and rewriting the xd_search function and getting rid of the execs there. Before doing that, I decided to do another benchmark of several native PHP-approaches for recursive directory listing (found mostly on php.net/scandir) against the Linux/UNIX `find`. The results were interesting.

For short listings with up to 100 file/directories, the native PHP-functions did better. For longer listings though, the system find literally smashed PHP progressively with increasing the listing.
This is important information since most people would not limit the managed files/directories under 100 and with this short number of files, the performance difference couldn't be noticed in the most cases. As you can imagine, I decided to keep the system functions there and expanded the search by including searching in descriptions which I consider a crucial improvement of the functionality as I am trying to show in the next example:
Imagine you need to have an own catalogue of scientific articles which you consider most important in your field. You can sort PDF-files with the articles in different directories, then assign appropriate "Filters" to every article and paste its Abstract along with any of your personal notes in the description of the PDF-file (article). Now you can do a search including looking into the descriptions to find any articles relevant for what you are interested. I personally found that quite useful as I know that the results would be my personally selected landmark articles and not everything out of a general database.

Anyway: XODA-0.4.3 is out and awaiting testing. Give it a try and let me know what you think! Thanks! :)