Optimizing singleton calculation

Optimizing singleton calculation by caching injection map and avoid calculate dep everytime.