Calling (vl-file-directory-p...) several times in a loop can cause noticeable delays, so I try to organize the same-folder searches with a single call to (vl-directory-files...) with arguments to return folders only, then check for membership in the returned list.