Welcome Guest, Not a member yet? Register   Sign In
Automatic templating of text files within a directory (with caching)
#10

[eluser]OwanH[/eluser]
[quote author="sophistry" date="1184140403"]now, are you ready to do some tests that show that this is an optimization over simply reading the directory tree each time?

i'd bet that you'd have to have some pretty deep trees and thousands of files to see any benefit to building out this whole set of code.[/quote]

sophistry you are right, there'd have to be some pretty deep trees and a significant number of files to see any noticeable benefit to building out this set of code. And as you said getting directories is really fast in PHP because PHP simply maps their functions to appropriate system calls.

Having said that, the reason I threw together this set of code was to simply help show BlkAngel a solution to what he/she was asking. I do not know the scope of his/her specific application and so I have no grounds on which I can say whether to use my solution (or a modification of it) or simply go with PHP's directory/filesystem functions. BlkAngel would have to determine which is a more suitable solution for the application.

Also, keep in mind that there is nothing new about a solution such as this. I know some operating systems (like Win XP, UNIX, Linux) provide an implementation of some kind of directory "index" builder that allows you to create a cache of some sort of the contents and heirarchy tree of a given directory. But, to my knowledge, it's up to the user to enable such a feature on these OS'. It's all simply a matter of context. So I am in no way forcing my solution on BlkAngel, it's his/her call.

One more thing I would add is that I agree some tests should indeed be done to determine if this kind of solution would provide an optimization within the scope of the target application.


Messages In This Thread
Automatic templating of text files within a directory (with caching) - by El Forum - 07-11-2007, 08:08 AM



Theme © iAndrew 2016 - Forum software by © MyBB