See #1014130: install_profile_info() does a file system scan on every request to admin/config (and etc.) for background.

If you want to get the name or version of the current install profile, the obvious choice is to use http://api.drupal.org/api/drupal/includes--install.inc/function/install_..., there's also http://api.drupal.org/api/drupal/includes--install.inc/function/drupal_i...

However install_profile_info() always does a full system scan, to get information about install profile dependencies, since it was originally designed for use only in the installer.

An easy workaround is to use system_get_info(), but that's a bit uglier since you have to provide defaults yourself.

Since both core and mollom were doing 2-3 second file directory scans to get this information (albeit on admin pages/ cache misses, but that's still 2-3 seconds), it would be good to have an API function for it that gets the information from the system table when it's available.

Comments

Subscribing.

@carlos8f's patch at #1014130-6: install_profile_info() does a file system scan on every request to admin/config (and etc.) might be a starting point for this - since it fixes the performance of install_profile_info() itself - although it still needs some work as per subsequent comments in that issue.