diff --git a/include/ada/scheme-inl.h b/include/ada/scheme-inl.h index 465f33761..aea9c2f57 100644 --- a/include/ada/scheme-inl.h +++ b/include/ada/scheme-inl.h @@ -24,14 +24,17 @@ constexpr uint16_t special_ports[] = {80, 0, 443, 80, 21, 443, 0, 0}; /**** * In is_special, get_scheme_type, and get_special_port, we - * use a standard hashing technique to find the index of the scheme in the - * is_special_list. The hashing technique is based on the size of the scheme - * and the first character of the scheme. It ensures that we do at most one - * string comparison per call. If the protocol is predictible (e.g., it is - * always "http"), we can get a better average performance by using a a - * simpler approach where we loop and compare scheme with all possible - * protocol. In this instance, we choose a potentially slightly lower - * best-case performance for a better worst-case performance. + * use a standard hashing technique to find the index of the scheme in + * the is_special_list. The hashing technique is based on the size of + * the scheme and the first character of the scheme. It ensures that we + * do at most one string comparison per call. If the protocol is + * predictible (e.g., it is always "http"), we can get a better average + * performance by using a simpler approach where we loop and compare + * scheme with all possible protocols starting with the most likely + * protocol. Doing multiple comparisons may have a poor worst case + * performance, however. In this instance, we choose a potentially slightly + * lower best-case performance for a better worst-case performance. + * We can revisit this choice at any time. * * Reference: * Schmidt, Douglas C. "Gperf: A perfect hash function generator." More C++