 When the format on disk changes, this value is changed, so that
 straight.el knows to regenerate the whole cache.")
 
+(defvar straight--build-cache-text nil
+  "Literal text of the build cache.
+If this is unchanged between loading and saving the build cache,
+then the saving step is skipped for efficiency.")
+
 (defun straight--load-build-cache ()
   "Load data from build-cache.el into memory.
 This sets the variables `straight--build-cache',

        (ignore-errors
          (while t
            (push (read (current-buffer)) live-repos)))
        ;; We might end up in a situation where multiple Emacs
        ;; sessions push the same package to build-cache.el, so we'll
        ;; get rid of those for the sake of cleanliness.

  ;; malformed (or outdated), these values will be use.
  (setq straight--build-cache (make-hash-table :test #'equal))
  (setq straight--eagerly-checked-packages nil)
  (setq straight--live-modified-repos nil)
  (setq straight--build-cache-text nil)
  (ignore-errors
    (with-temp-buffer
      ;; Using `insert-file-contents-literally' avoids
