• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
      • Std/lists
      • Std/alists
        • Alist-keys
        • Remove-assocs
        • Alist-vals
        • Alist-map-vals
        • Std/alists/strip-cdrs
        • Hons-rassoc-equal
        • Alist-map-keys
        • Std/alists/hons-assoc-equal
        • Fal-extract
        • Std/alists/strip-cars
        • Fal-find-any
        • Fal-extract-vals
        • Std/alists/abstract
        • Fal-all-boundp
        • Std/alists/alistp
        • Append-alist-vals
        • Append-alist-keys
        • Alist-equiv
        • Hons-remove-assoc
        • Std/alists/pairlis$
        • Alists-agree
        • Worth-hashing
          • Sub-alistp
          • Alist-fix
          • Std/alists/remove-assoc-equal
          • Std/alists/assoc-equal
        • Obags
        • Std/util
        • Std/strings
        • Std/io
        • Std/osets
        • Std/system
        • Std/basic
        • Std/typed-lists
        • Std/bitsets
        • Std/testing
        • Std/typed-alists
        • Std/stobjs
        • Std-extensions
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Std/alists

    Worth-hashing

    Heuristic for deciding when to use fast-alists.

    Signature
    (worth-hashing x) → bool

    When alists are very short, it may be better for performance and memory usage to use naive alist algorithms instead of constructing hash tables.

    (worth-hashing x) is a rough heuristic that is used in various fast-alist operations (e.g., fal-all-boundp) to decide when alists are long enough or will be used heavily enough to justify constructing hash tables.

    It currently just decides whether x is longer than 18 elements long. This particular choice is just a historical oddity that probably has no empirical justification.

    Definitions and Theorems

    Function: worth-hashing$inline

    (defun worth-hashing$inline (x)
           (declare (xargs :guard t))
           (let ((__function__ 'worth-hashing))
                (declare (ignorable __function__))
                (mbe :logic (>= (len x) 18)
                     :exec (and (consp x)
                                (worth-hashing1 (cdr x) 17)))))