Deterministic complexity gate (#1527, O9: no clock). The resolver * primitives count every candidate they examine -- scope-frame probes, * registry lookup probes, enclosing-definition candidates -- plus every real * (non-memoized) expression evaluation, into a seam-build work counter. 4x * the input must cost about 4x the work: a linear-scan lookup or a lost memo * lands at ~16x (quadratic) o
| 2367 | * lands at ~16x (quadratic) or worse. Also asserts every call site resolved, |
| 2368 | * so the work is not "linear" because resolution stopped early. */ |
| 2369 | static uint64_t work_for(int n_classes, int *out_resolved) { |
| 2370 | int slen = 0; |
| 2371 | char *src = pylsp_work_fixture(n_classes, &slen); |
| 2372 | if (!src) |
| 2373 | return 0; |
| 2374 | (void)cbm_lsp_work_take(); |
| 2375 | CBMFileResult *r = |
| 2376 | cbm_extract_file(src, slen, CBM_LANG_PYTHON, "test", "scale.py", 0, NULL, NULL); |
| 2377 | uint64_t work = cbm_lsp_work_take(); |
| 2378 | *out_resolved = r ? r->resolved_calls.count : -1; |
| 2379 | if (r) |
| 2380 | cbm_free_result(r); |
| 2381 | free(src); |
| 2382 | return work; |
| 2383 | } |
| 2384 | |
| 2385 | TEST(pylsp_scale_work_is_linear) { |
| 2386 | int r1 = 0, r4 = 0; |
no test coverage detected