From 6a08de2203ce732f1bb0ae4a044162b1e6b14844 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Tue, 17 Jul 2012 16:04:27 -0700 Subject: [PATCH] hashtables.identity: cache the identity hashcode on the wrapper. --- basis/hashtables/identity/identity.factor | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/basis/hashtables/identity/identity.factor b/basis/hashtables/identity/identity.factor index f7601ebd7b..7ce6d33fd8 100644 --- a/basis/hashtables/identity/identity.factor +++ b/basis/hashtables/identity/identity.factor @@ -3,17 +3,17 @@ USING: accessors assocs hashtables hashtables.wrapped kernel parser vocabs.loader ; IN: hashtables.identity -TUPLE: identity-wrapper < wrapped-key ; +TUPLE: identity-wrapper < wrapped-key identity-hashcode ; -C: identity-wrapper +: ( wrapped-key -- identity-wrapper ) + dup identity-hashcode identity-wrapper boa ; inline M: identity-wrapper equal? over identity-wrapper? [ [ underlying>> ] bi@ eq? ] [ 2drop f ] if ; inline -M: identity-wrapper hashcode* - nip underlying>> identity-hashcode ; inline +M: identity-wrapper hashcode* nip identity-hashcode>> ; inline TUPLE: identity-hashtable < wrapped-hashtable ;