MCPcopy Create free account
hub / github.com/FastLED/FastLED / test_large_file_set_performance

Function test_large_file_set_performance

ci/test_hash_fingerprint_stress.py:388–433  ·  view source on GitHub ↗

Test performance with many files.

(results: StressTestResults)

Source from the content-addressed store, hash-verified

386
387
388def test_large_file_set_performance(results: StressTestResults) -> None:
389 """Test performance with many files."""
390 print("\n📋 TEST 8: Large File Set Performance")
391 print("-" * 70)
392
393 with tempfile.TemporaryDirectory() as temp_dir:
394 temp_path = Path(temp_dir)
395 test_dir = temp_path / "test_files"
396 cache_dir = temp_path / ".cache"
397
398 # Create 500 files (simulating larger codebase)
399 print(" Creating 500 test files...")
400 create_test_files(test_dir, 500)
401 print(" Done.")
402 root = str(test_dir)
403
404 cache = HashFingerprintCache(cache_dir, "perf_test")
405
406 # Time the check_needs_update
407 start = time.time()
408 cache.check_needs_update(include=_TEST_INCLUDE, root=root)
409 check_time = time.time() - start
410
411 if check_time < 5.0:
412 results.pass_test(
413 f"check_needs_update with 500 files completed in {check_time:.3f}s"
414 )
415 else:
416 results.fail_test(
417 "check_needs_update with 500 files < 5s",
418 f"Took {check_time:.3f}s",
419 )
420
421 # Time the mark_success
422 start = time.time()
423 cache.mark_success()
424 mark_time = time.time() - start
425
426 if mark_time < 2.0:
427 results.pass_test(
428 f"mark_success with 500 files completed in {mark_time:.3f}s"
429 )
430 else:
431 results.fail_test(
432 "mark_success with 500 files < 2s", f"Took {mark_time:.3f}s"
433 )
434
435
436def test_race_condition_rapid_operations(results: StressTestResults) -> None:

Callers 1

mainFunction · 0.85

Calls 8

check_needs_updateMethod · 0.95
mark_successMethod · 0.95
timeMethod · 0.80
create_test_filesFunction · 0.70
printFunction · 0.50
pass_testMethod · 0.45
fail_testMethod · 0.45

Tested by

no test coverage detected