Optimize resolve performance by performing cheap checks before expensive ones.
Merge pull request #1018 from yole/resolve-performance-optimizations

Optimize resolve performance by performing cheap checks before expensive ones.