/
Optimize unit config searching code [5.3.0-B1]
Optimize unit config searching code [5.3.0-B1]
The unit config is core of concept in In-Portal and it represents one unit (type of data, e.g. products) that can be operated upon. As for unit config searching code it:
- must be fast to find files quickly even in extensive directory structures
- skip folders, that are not useful (e.g. ".svn")
- return only folders, containing unit config files
I've found few places where we can speed up existing code (current time to find all unit configs: 0.0073s):
- don't scan ".git" folder (we're already skipping ".svn" so this is natural to exclude this folder as well)
- don't scan "install" folder, because in 5.3.x+ versions it would contain a lot of sub-directories, that won't have any unit configs in them
- use "substr" instead of "preg_match" for skipping hidden folders
After above mentioned improvements the scan time dropped to 0.0068s.