reverted to initializing visited with empty dictionary.
Performance is now ok with Xcode 6.1 Beta.