diff --git a/CHANGELOG.md b/CHANGELOG.md index 42f6368f..546d1ec9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,10 @@ Features -- Improved hash table lookup performance for symbols and increased the max bound of hash tables to `(2 ^ 30) - 1`. +- Made several performance improvements to SRFI 69 hash tables, including: + - Improved hash table lookup performance for symbols + - Increased the max bound of hash tables to `(2 ^ 30) - 1`. + - Changed `hash-by-identity` to a high-performance builtin. - Added basic support for square and curly brackets in place of parentheses. Bug Fixes diff --git a/srfi/69.sld b/srfi/69.sld index 77d0d320..f63daeff 100644 --- a/srfi/69.sld +++ b/srfi/69.sld @@ -93,7 +93,10 @@ ((procedure? obj) (error "hash: procedures cannot be hashed" obj)) (else 1)))) -(define hash-by-identity hash) +(define (hash-by-identity obj . maybe-bound) + (let ((bound (if (null? maybe-bound) *default-bound* (car maybe-bound))) + (mem-loc (symbol-hash obj))) ;; Obj memory location (or value) as fixnum + (modulo mem-loc bound))) (define (vector-hash v bound) (let ((hashvalue 571)