The vSphere_SDK.pm:_get_file_info subroutine is unnecessarily slow on systems with large numbers of virtual machines (especially vCenter clusters).
This is due to an overly comprehensive query definition in the HostDatastoreBrowserSearchSpec object.
The query definition includes the following (around line 2483):
But in truth only the following are needed in the query:
In my system, this drops the execution time of _get_file_info() from ~ 3.5 minutes to ~ 5 seconds.