From 2fcdd7c29223b4a0d1491319716e7d461c15fbb2 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 28 Dec 2019 08:05:22 -0600 Subject: [PATCH] cs: improve `equal?`-based immutable hash Check leaf hash code before a more general (and potentially much slower) equality check. --- racket/src/cs/rumble/intmap.ss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/racket/src/cs/rumble/intmap.ss b/racket/src/cs/rumble/intmap.ss index 36bf719363..ea2c181f5a 100644 --- a/racket/src/cs/rumble/intmap.ss +++ b/racket/src/cs/rumble/intmap.ss @@ -84,7 +84,8 @@ (loop (Br-right t)))] [(Lf? t) - (if (key=? et key (Lf-key t)) + (if (and (fx= h (Lf-hash t)) + (key=? et key (Lf-key t))) (with-leaf t) default)]