From 506f8708ba71be572b885e4b59cc4abd4156be0d Mon Sep 17 00:00:00 2001
From: Dylan Baker <dylan@pnwbakers.com>
Date: Mon, 22 Apr 2019 16:02:40 -0700
Subject: mesonlib: use zip() in Version

Instead of range. This makes version comparison 25-50% faster depending
on the operator and how different the values are.
---
 mesonbuild/mesonlib.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index 25e15e4..a9d4391 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -537,22 +537,22 @@ class Version:
             return (a > b) - (a < b)
 
         # compare each sequence in order
-        for i in range(0, min(len(self._v), len(other._v))):
+        for ours, theirs in zip(self._v, other._v):
             # sort a non-digit sequence before a digit sequence
-            if self._v[i].isdigit() != other._v[i].isdigit():
-                return 1 if self._v[i].isdigit() else -1
+            if ours.isdigit() != theirs.isdigit():
+                return 1 if ours.isdigit() else -1
 
             # compare as numbers
-            if self._v[i].isdigit():
+            if ours.isdigit():
                 # because leading zeros have already been removed, if one number
                 # has more digits, it is greater
-                c = cmp(len(self._v[i]), len(other._v[i]))
+                c = cmp(len(ours), len(theirs))
                 if c != 0:
                     return c
                 # fallthrough
 
             # compare lexicographically
-            c = cmp(self._v[i], other._v[i])
+            c = cmp(ours, theirs)
             if c != 0:
                 return c
 
-- 
cgit v1.1