You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2023/08/14 21:47:57 UTC
[trafficserver] branch 9.2.x updated: cache_range test performance improvement (#10170)
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.2.x by this push:
new 6fd40f8df9 cache_range test performance improvement (#10170)
6fd40f8df9 is described below
commit 6fd40f8df9bd85ffb32224d6e6260d819aba5adb
Author: Brian Neradt <br...@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).
(cherry picked from commit 68f126376f1caaa4739de4a4caab6347d651b2dd)
---
.../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 371ed64873..de15454732 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", command="traffic_server")