Short circuit IsXIDStart check.

Our common case is ASCII characters but, because those come at the start
of the XID Start range they'll end up being checked _last_ as we binary
search through the range. This means we're getting the worst case
behaviour for our common character.

This CL adds a quick check for [a-zA-Z] at the start of IsXIDStart to
quickly determine if we're an ascii character.

Change-Id: Iae733b0e8a64c855764cf58c0563a407e6a81f7d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97068
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/text/unicode.cc b/src/tint/text/unicode.cc
index bf28c4e..7339297 100644
--- a/src/tint/text/unicode.cc
+++ b/src/tint/text/unicode.cc
@@ -306,6 +306,11 @@
 }  // namespace
 
 bool CodePoint::IsXIDStart() const {
+    // Short circuit ascii. It will end up being at the end of the binary search
+    // but is our, currently, common case.
+    if ((value >= 'a' && value <= 'z') || (value >= 'A' && value <= 'Z')) {
+        return true;
+    }
     return std::binary_search(kXIDStartRanges, kXIDStartRanges + kNumXIDStartRanges, *this);
 }