This is an automated email from the ASF dual-hosted git repository.

bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 68f126376f cache_range test performance improvement (#10170)
68f126376f is described below

commit 68f126376f1caaa4739de4a4caab6347d651b2dd
Author: Brian Neradt <brian.ner...@gmail.com>
AuthorDate: Thu Aug 10 21:45:04 2023 -0500

    cache_range test performance improvement (#10170)
    
    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 12256b889d..38686e9358 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 @@ Test.testName = "cache_range_requests_cache_200s"
 
 # 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")

Reply via email to