From 90a1f7d47525cfffe928e9a89becf622bd85a8a1 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Fri, 22 Jun 2018 22:22:24 +0200 Subject: Initial CHICKEN 5 port of intarweb 1.7 --- benchmarks/unparsers.scm | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 benchmarks/unparsers.scm (limited to 'benchmarks/unparsers.scm') diff --git a/benchmarks/unparsers.scm b/benchmarks/unparsers.scm new file mode 100644 index 0000000..b8db0c8 --- /dev/null +++ b/benchmarks/unparsers.scm @@ -0,0 +1,54 @@ +(import chicken.port chicken.time chicken.time.posix intarweb uri-common) + +(define null-output-port + (make-output-port void void)) + +(begin (newline) + (print "--- Response unparsing ---") + (begin (print "Unparsing a minimal HTTP/1.1 response many times") + (let ((response (make-response port: null-output-port))) + (time (do ((i 0 (add1 i))) + ((= i 100000)) + (write-response response))))) + + (begin (print "Unparsing a realistic HTTP/1.1 response many times") + (let ((response + (make-response + port: null-output-port + headers: (headers + `((content-type text/css) + (etag (strong . "1234-0123456789")) + (content-length 1234) + (last-modified #(,(seconds->utc-time (current-seconds)) ())) + (date #(,(seconds->utc-time (current-seconds)) ()))))))) + (time (do ((i 0 (add1 i))) + ((= i 100000)) + (write-response response)))))) + +(begin (newline) + (print "--- Request unparsing ---") + (begin (print "Unparsing a minimal HTTP/1.1 request many times") + (let ((request + (make-request port: null-output-port))) + (time (do ((i 0 (add1 i))) + ((= i 100000)) + (write-request request))))) + + (begin (print "Unparsing a realistic HTTP/1.1 request many times") + (let ((request + (make-request + port: null-output-port + uri: (uri-reference "http://www.call-cc.org/test.example") + headers: (headers + `((user-agent (("Mozilla" "5.0" + "X11; U; NetBSD amd64; en-US; rv:1.9.0.3") + ("Gecko" "2008110501" #f) + ("Minefield" "3.0.3" #f))) + (host ("example.com" . 8080)) + (accept text/html application/xhtml+xml + #(application/xml ((q . 0.9))) #(*/* ((q . 0.8)))) + (accept-language en-US #(en ((q . 0.5)))) + (accept-encoding gzip deflate)))))) + (time (do ((i 0 (add1 i))) + ((= i 100000)) + (write-request request)))))) -- cgit v1.2.3