Linear-scan / membership calls: a hit inside a loop is the textbook hidden O(n^2) (cf. Olivo et al., PLDI'15) that syntactic loop-depth alone misses.
| 1069 | // Linear-scan / membership calls: a hit inside a loop is the textbook hidden |
| 1070 | // O(n^2) (cf. Olivo et al., PLDI'15) that syntactic loop-depth alone misses. |
| 1071 | static bool is_linear_scan_name(const char *n) { |
| 1072 | static const char *const set[] = {"find", "indexof", "contains", "includes", "search", |
| 1073 | "lookup", "strstr", "strchr", "strrchr", "memchr", |
| 1074 | "find_if", "findindex", "count", "index", NULL}; |
| 1075 | return name_in_set(n, set); |
| 1076 | } |
| 1077 | |
| 1078 | // Allocation / growable-append calls: repeated inside a loop is the classic |
| 1079 | // accidental reallocation / string-concat O(n^2). Names are deliberately |
no test coverage detected