small JSON encoder improvement
Jens Thiele <[email protected]> Tue, 24 Sep 2024 17:55:18 +0200
| Newsgroups | gmane.lisp.scheme.gauche |
|---|---|
| Message-ID | <[email protected]> |
in my test I see a suprisingly big performance improvement with this
one:
30s instead of 38s
diff --git a/lib/rfc/json.scm b/lib/rfc/json.scm
index 73fd021ab..48fcd5956 100644
--- a/lib/rfc/json.scm
+++ b/lib/rfc/json.scm
@@ -307,9 +307,9 @@
(if (>= code #x10000)
(for-each hexescape (ucs4->utf16 code))
(hexescape code)))]))
- (display "\"")
+ (write-char #\")
(string-for-each print-char str)
- (display "\""))
+ (write-char #\"))
(define (construct-json x :optional (oport (current-output-port)))
(with-output-to-port oport