[nginx-tests] Tests: improved proxy_unfinished.t performance.

Maxim Dounin mdounin at mdounin.ru
Wed Jul 23 18:55:11 UTC 2025


details: http://freenginx.org/hg/nginx-tests/rev/b04d3b7129f6
branches: 
changeset: 2012:b04d3b7129f6
user: Maxim Dounin <mdounin at mdounin.ru>
date: Sat Jul 19 05:24:29 2025 +0300
description:
Tests: improved proxy_unfinished.t performance.
There is no real reasons to use "for (1 .. 10000) { print ... }" loops
in the test server, yet they require a lot of CPU, leading to occasional
test failures on slow hosts. Accordingly, such constructs were changed
to prints with large buffers instead.
diffstat:
 proxy_unfinished.t | 8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
diffs (25 lines):
diff --git a/proxy_unfinished.t b/proxy_unfinished.t
--- a/proxy_unfinished.t
+++ b/proxy_unfinished.t
@@ -216,9 +216,7 @@ sub http_daemon {
 				"Cache-Control: max-age=300" . CRLF .
 				"Connection: close" . CRLF .
 				CRLF;
-			for (1 .. 10000) {
-				print $client ("X" x 98) . CRLF;
-			}
+			print $client (("X" x 98) . CRLF) x 10000;
 			print $client "unfinished" . CRLF;
 
 		} elsif ($uri eq '/big/ok') {
@@ -228,9 +226,7 @@ sub http_daemon {
 				"Cache-Control: max-age=300" . CRLF .
 				"Connection: close" . CRLF .
 				CRLF;
-			for (1 .. 10000) {
-				print $client ("X" x 98) . CRLF;
-			}
+			print $client (("X" x 98) . CRLF) x 10000;
 			print $client "finished" . CRLF;
 
 		} elsif ($uri eq '/chunked') {


More information about the nginx-devel mailing list

AltStyle によって変換されたページ (->オリジナル) /