Skip to content

Commit 65e9c06

Browse files
committed
suggestion_list: micro-optimisation
Replicates graphql/graphql-js@e545162
1 parent b9d4492 commit 65e9c06

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/graphql/pyutils/suggestion_list.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ def measure(self, option: str, threshold: int) -> Optional[int]:
5858

5959
a, b = option_lower_case, self._input_lower_case
6060
a_len, b_len = len(a), len(b)
61+
if a_len < b_len:
62+
a, b = b, a
63+
a_len, b_len = b_len, a_len
6164

62-
if abs(a_len - b_len) > threshold:
65+
if a_len - b_len > threshold:
6366
return None
6467

6568
rows = self._rows

0 commit comments

Comments
 (0)