[llvm] [LIT] Add --load-limit N option (PR #197883)

Maxim Pavlenko via llvm-commits llvm-commits at lists.llvm.org
Thu May 21 03:05:36 PDT 2026


MaximPavlenko wrote:

Hi @boomanaiden154, I did some performance tuning and prepared the numbers.

Without `--load-limit` average time is about 0.000001 seconds (1 additional second for 1 million of tests). 
`python /SCRATCH/pavlenko/GIT_llvm_project_pavlenko/llvm-project/llvm/utils/lit/lit.py -j 10 --xunit-xml-output=results.xml -v
-- Testing: 32 tests, 10 workers --
Execution time: 0.00000112 seconds
Execution time: 0.00000107 seconds
Execution time: 0.00000083 seconds
Execution time: 0.00000095 seconds
Execution time: 0.00000124 seconds
Execution time: 0.00000073 seconds
Execution time: 0.00000098 seconds
Execution time: 0.00000086 seconds
Execution time: 0.00000072 seconds
Execution time: 0.00000101 seconds
Execution time: 0.00000098 seconds
Execution time: 0.00000079 seconds
Execution time: 0.00000125 seconds
Execution time: 0.00000122 seconds
Execution time: 0.00000069 seconds
Execution time: 0.00000092 seconds
Execution time: 0.00000118 seconds
Execution time: 0.00000061 seconds
Execution time: 0.00000140 seconds
Execution time: 0.00000145 seconds
Execution time: 0.00000073 seconds
Execution time: 0.00000103 seconds
Execution time: 0.00000103 seconds
Execution time: 0.00000077 seconds
Execution time: 0.00000119 seconds
Execution time: 0.00000091 seconds
Execution time: 0.00000066 seconds
Execution time: 0.00000085 seconds
Execution time: 0.00000097 seconds
Execution time: 0.00000110 seconds
Execution time: 0.00000067 seconds
Execution time: 0.00000060 seconds

Testing Time: 9.80s

Total Discovered Tests: 32
  Passed: 32 (100.00%)
`

With `--load-limit` average time is about 0.0001 seconds (1 additional second for 10k of tests). 
`python /SCRATCH/pavlenko/GIT_llvm_project_pavlenko/llvm-project/llvm/utils/lit/lit.py -j 10 --load-limit=1 --xunit-xml-output=results.xml -v
-- Testing: 32 tests, 10 workers, load-limit 100% --
Execution time: 0.00013140 seconds
Execution time: 0.00005448 seconds
Execution time: 0.00004627 seconds
Execution time: 0.00011769 seconds
Execution time: 0.00005913 seconds
Execution time: 0.00004911 seconds
Execution time: 0.00011352 seconds
Execution time: 0.00005203 seconds
Execution time: 0.00004674 seconds
Execution time: 0.00011000 seconds
Execution time: 0.00005944 seconds
Execution time: 0.00004809 seconds
Execution time: 0.00011738 seconds
Execution time: 0.00006081 seconds
Execution time: 0.00005607 seconds
Execution time: 0.00011179 seconds
Execution time: 0.00005668 seconds
Execution time: 0.00003882 seconds
Execution time: 0.00010930 seconds
Execution time: 0.00004829 seconds
Execution time: 0.00004156 seconds
Execution time: 0.00010550 seconds
Execution time: 0.00005341 seconds
Execution time: 0.00004537 seconds
Execution time: 0.00011030 seconds
Execution time: 0.00005810 seconds
Execution time: 0.00005060 seconds
Execution time: 0.00007038 seconds
Execution time: 0.00013342 seconds
Execution time: 0.00008614 seconds
Execution time: 0.00005929 seconds
Execution time: 0.00004499 seconds

Testing Time: 9.93s

Total Discovered Tests: 32
`

How measurements were done:
`def execute(test):
    start_time = time.perf_counter()
    if _load_limit:
        _acquire_run_slot()
    end_time = time.perf_counter()
    tmp_time = end_time - start_time
    try:
        with _get_parallelism_semaphore(test):
            result = _execute(test, _lit_config)
    finally:
        start_time = time.perf_counter()
        if _load_limit:
            _release_run_slot()
        end_time = time.perf_counter()
        tmp_time_2 = end_time - start_time
    print(f"Execution time: {tmp_time + tmp_time_2:.8f} seconds")

    test.setResult(result)
    return test
`



https://github.com/llvm/llvm-project/pull/197883


More information about the llvm-commits mailing list