;;;;
;;;; * Since the cache is used for memoization only we don't need to
;;;; worry about which of simultaneous replacements (when expanding
;;;;
;;;; * Since the cache is used for memoization only we don't need to
;;;; worry about which of simultaneous replacements (when expanding
;;;; redone later. This also allows us to drop entries when the
;;;; cache is about to grow insanely huge.
;;;;
;;;; redone later. This also allows us to drop entries when the
;;;; cache is about to grow insanely huge.
;;;;
(cache-mask copy) (compute-cache-mask length (cache-line-size cache))
(cache-limit copy) (compute-limit (/ length (cache-line-size cache))))
;; First insert the new one -- if we don't do this first and
(cache-mask copy) (compute-cache-mask length (cache-line-size cache))
(cache-limit copy) (compute-limit (/ length (cache-line-size cache))))
;; First insert the new one -- if we don't do this first and
(unless (try-update-cache copy layouts value)
(bug "Could not insert ~S:~S to supposedly empty ~S." layouts value copy))
(map-cache (if drop-random-entries
(unless (try-update-cache copy layouts value)
(bug "Could not insert ~S:~S to supposedly empty ~S." layouts value copy))
(map-cache (if drop-random-entries
;; rut: add A causing B to drop, then add B
;; causing A to drop... repeat ad nauseam,
;; spending most of the time here instead of
;; rut: add A causing B to drop, then add B
;; causing A to drop... repeat ad nauseam,
;; spending most of the time here instead of
;; recompute more then we'd like.
;; _Experimentally_ 50% seems to perform the
;; best, but it would be nice to have a proper
;; recompute more then we'd like.
;; _Experimentally_ 50% seems to perform the
;; best, but it would be nice to have a proper