a couple of grayrest's speed improvements for _.isEqual
(cherry picked from commit a97836a175c6d0bc03533cfc66e051f70cc5a4f8)