From b716cff939928ef57dae61f24f0ee0685eb5b189 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Mon, 6 Apr 2020 14:29:19 -0700 Subject: [PATCH] use FASL for caching (#221) --- pollen/private/cache-utils.rkt | 9 ++++++--- pollen/private/ts.rktd | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pollen/private/cache-utils.rkt b/pollen/private/cache-utils.rkt index 4537742..f95eab6 100644 --- a/pollen/private/cache-utils.rkt +++ b/pollen/private/cache-utils.rkt @@ -8,9 +8,9 @@ racket/path racket/list racket/match - racket/serialize sugar/coerce sugar/test + racket/fasl compiler/cm) (provide (all-defined-out)) @@ -109,7 +109,9 @@ (define dest-file (build-path cache-dir (format "~a.rktd" dest-path-filename))) (define (generate-dest-file) (message-debug (format "cache miss for ~a" dest-file)) - (write-to-file (serialize (path-hash-thunk)) dest-file #:exists 'replace)) + (with-output-to-file dest-file + (λ () (s-exp->fasl (path-hash-thunk) (current-output-port))) + #:exists 'replace)) ;; `cache-file` looks for a file in private-cache-dir previously cached with key ;; (which in this case carries modification dates and POLLEN env). @@ -132,4 +134,5 @@ [(or "cache attempt failed: could not acquire exclusive lock" "cache attempt failed: could not acquire shared lock") (void)] [_ (log-pollen-error str)]))) - (deserialize (file->value dest-file))) + (with-input-from-file dest-file + (λ () (fasl->s-exp (current-input-port))))) diff --git a/pollen/private/ts.rktd b/pollen/private/ts.rktd index 287c017..ebde6f6 100644 --- a/pollen/private/ts.rktd +++ b/pollen/private/ts.rktd @@ -1 +1 @@ -1586184205 +1586206283