MCPcopy Index your code
hub / github.com/unclecode/crawl4ai / test_concurrent_crawling_performance

Function test_concurrent_crawling_performance

tests/async/test_performance.py:28–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26
27@pytest.mark.asyncio
28async def test_concurrent_crawling_performance():
29 async with AsyncWebCrawler(verbose=True) as crawler:
30 urls = [
31 "https://www.nbcnews.com/business",
32 "https://www.example.com",
33 "https://www.python.org",
34 "https://www.github.com",
35 "https://www.stackoverflow.com"
36 ]
37
38 start_time = time.time()
39 results = await crawler.arun_many(urls=urls, bypass_cache=True)
40 end_time = time.time()
41
42 total_time = end_time - start_time
43 print(f"Total time for concurrent crawling: {total_time:.2f} seconds")
44
45 assert all(result.success for result in results)
46 assert len(results) == len(urls)
47
48 assert total_time < len(urls) * 5, f"Concurrent crawling not significantly faster: {total_time:.2f} seconds"
49
50@pytest.mark.asyncio
51async def test_crawl_speed_with_caching():

Callers

nothing calls this directly

Calls 2

AsyncWebCrawlerClass · 0.90
arun_manyMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…