Make ol.Object#getKeys about 10x faster

This is an alternative to #1223. In my test example, this reduces the time spent in `ol.Object#getKeys` from 25% to about 2%.