Here is a small diff on top of >>292 to time the sexp read/write in bbs.scm:post-message in the REPL of MIT/GNU Scheme 9.1.1. It comments out the thread-list and frontpage updates and makes the redirect absolute.
--- bbs-edit.scm 2020-06-15 22:57:40.125009000 +0000
+++ bbs-edit2.scm 2020-06-17 02:41:55.660698507 +0000
@@ -275,10 +275,10 @@
(content . ,sxml)))))
(call-with-output-file path (lambda (port) (write t port)))
(if (file-exists? cache) (rename-file cache (name-cache-old cache)))
- (if vip
- (update-post-count board thread date post-number)
- (update-thread-list board (string->number thread) date post-number))
- (update-frontpage board)
+ ;(if vip
+ ; (update-post-count board thread date post-number)
+ ; (update-thread-list board (string->number thread) date post-number))
+ ;(update-frontpage board)
(if (equal? frontpage "true")
(redirection board thread (number->string post-number) query-string #t #f)
(redirection board thread (number->string post-number) query-string #f #f))))))
@@ -297,7 +297,7 @@
"That was SICP quality!")
`(303 ,(list (make-http-header
'location
- (string-append (add-query-string (string-append "/" board "/" thread) query-string) "#t" thread "p" post)))
+ (string-append "http://x.y" (add-query-string (string-append "/" board "/" thread) query-string) "#t" thread "p" post)))
"That was SICP quality")))
(define (update-post-count board thread date post-count)
The test is on https://textboard.org/sexp/prog/39 at 286. To fake a simple request manually for post-message the mandatory post fields are those that the let* retrieves using a defaultless lookup-def rather than assq.
$ mit-scheme --load bbs-edit2.scm --load test.scm
[...]
;Loading "test.scm"... done
1 ]=> (timeit (lambda () (post-message "prog" "39" (make-http-request "POST" (string->uri "/uri") '(1 . 0) '() "frontpage=false&epistula=hello") "")))
.08 .02 .093
;Value 13: (303 (#[http-header 14 location]) "That was SICP quality")
Reading and writing the sexp together take up less than a tenth of a second at 286, so the sexp file does not need the incremental generation treatment.