Few small optimizations on _get_revision function

Still to improve the usage of self.revisions which makes this code in some cases super slow