The media source tree does lots of API calls to S3 and this can be resource intensive if you have several S3 media source with nested folders.
Use xPDOCacheManager to cache the what the directory and files are in the media source. When a file or folder is created, updated or deleted also clear the cache for the related tree.