From 209e63b0d852b6eebe2749511dc4b73e62961d0b Mon Sep 17 00:00:00 2001 From: Brian Neradt Date: Thu, 10 Aug 2023 16:51:03 +0000 Subject: [PATCH] cache_range test performance improvement cache_range_requests_cache_complete_responses.test.py had a for loop where it appended a single character to a string 4 million times. This is exceedingly slow in Python as it needed to reallocate, copy, and append with each iteration. This patched version reduces the time to a fraction of a second instead of multiple minutes (4 minutes on my system). --- .../cache_range_requests_cache_complete_responses.test.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cache_complete_responses.test.py b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cache_complete_responses.test.py index 12256b889d9..38686e9358f 100644 --- a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cache_complete_responses.test.py +++ b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests_cache_complete_responses.test.py @@ -49,14 +49,10 @@ # Generate bodies for our responses small_body_len = 10000 -small_body = '' -for i in range(small_body_len): - small_body += 'x' +small_body = 'x' * small_body_len slice_body_len = 4 * 1024 * 1024 -slice_body = '' -for i in range(slice_body_len): - slice_body += 'x' +slice_body = 'x' * slice_body_len # Define and configure ATS ts = Test.MakeATSProcess("ts")