mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 05:39:17 +02:00
Issue #176 - Improve hash-by-identity
This commit is contained in:
parent
2097251f5e
commit
a42b5acdc8
2 changed files with 8 additions and 2 deletions
|
@ -4,7 +4,10 @@
|
||||||
|
|
||||||
Features
|
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.
|
- Added basic support for square and curly brackets in place of parentheses.
|
||||||
|
|
||||||
Bug Fixes
|
Bug Fixes
|
||||||
|
|
|
@ -93,7 +93,10 @@
|
||||||
((procedure? obj) (error "hash: procedures cannot be hashed" obj))
|
((procedure? obj) (error "hash: procedures cannot be hashed" obj))
|
||||||
(else 1))))
|
(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)
|
(define (vector-hash v bound)
|
||||||
(let ((hashvalue 571)
|
(let ((hashvalue 571)
|
||||||
|
|
Loading…
Add table
Reference in a new issue