iImprove performance by using proper functions to write string to file - cl-yag - Common Lisp Yet Another website Generator Err bitreich.org 70
hgit clone git://bitreich.org/cl-yag/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/cl-yag/ URL:git://bitreich.org/cl-yag/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/cl-yag/ bitreich.org 70
1Log /scm/cl-yag/log.gph bitreich.org 70
1Files /scm/cl-yag/files.gph bitreich.org 70
1Refs /scm/cl-yag/refs.gph bitreich.org 70
1Tags /scm/cl-yag/tag bitreich.org 70
1README /scm/cl-yag/file/README.md.gph bitreich.org 70
1LICENSE /scm/cl-yag/file/LICENSE.gph bitreich.org 70
i--- Err bitreich.org 70
1commit 5e3abb608d7259d1c4acdd5be13a711fe4b49160 /scm/cl-yag/commit/5e3abb608d7259d1c4acdd5be13a711fe4b49160.gph bitreich.org 70
1parent 5c2a1c9632b5d0b6b0f21fb330dc5b19bcc6b244 /scm/cl-yag/commit/5c2a1c9632b5d0b6b0f21fb330dc5b19bcc6b244.gph bitreich.org 70
hAuthor: Solene Rapenne <solene@perso.pw> URL:mailto:solene@perso.pw bitreich.org 70
iDate: Tue, 27 Aug 2019 09:07:18 +0200 Err bitreich.org 70
i Err bitreich.org 70
iImprove performance by using proper functions to write string to file Err bitreich.org 70
i Err bitreich.org 70
iDiffstat: Err bitreich.org 70
i M generator.lisp | 14 +++++--------- Err bitreich.org 70
i Err bitreich.org 70
i1 file changed, 5 insertions(+), 9 deletions(-) Err bitreich.org 70
i--- Err bitreich.org 70
1diff --git a/generator.lisp b/generator.lisp /scm/cl-yag/file/generator.lisp.gph bitreich.org 70
i@@ -100,14 +100,10 @@ Err bitreich.org 70
i ;; we escape ~ to avoid failures with format Err bitreich.org 70
i (defun load-file(path) Err bitreich.org 70
i (if (probe-file path) Err bitreich.org 70
i- (replace-all Err bitreich.org 70
i- (apply #'concatenate 'string Err bitreich.org 70
i- (with-open-file (stream path) Err bitreich.org 70
i- (loop for line = (read-line stream nil) Err bitreich.org 70
i- while line Err bitreich.org 70
i- collect Err bitreich.org 70
i- (format nil "~a~%" line)))) Err bitreich.org 70
i- "~" "~~") Err bitreich.org 70
i+ (with-open-file (stream path) Err bitreich.org 70
i+ (let ((contents (make-string (file-length stream)))) Err bitreich.org 70
i+ (read-sequence contents stream) Err bitreich.org 70
i+ contents)) Err bitreich.org 70
i (progn Err bitreich.org 70
i (format t "ERROR : file ~a not found. Aborting~%" path) Err bitreich.org 70
i (quit)))) Err bitreich.org 70
i@@ -115,7 +111,7 @@ Err bitreich.org 70
i ;; save a string in a file Err bitreich.org 70
i (defun save-file(path data) Err bitreich.org 70
i (with-open-file (stream path :direction :output :if-exists :supersede) Err bitreich.org 70
i- (format stream data))) Err bitreich.org 70
i+ (write-sequence data stream))) Err bitreich.org 70
i Err bitreich.org 70
i ;; simplify the str replace work Err bitreich.org 70
i (defmacro template(before &body after) Err bitreich.org 70
.
Response:
text/plain