From b96aea44193617158428d3e4c8dc04bbee7cae1f Mon Sep 17 00:00:00 2001 From: Cassie Jones Date: Mon, 17 Feb 2020 14:15:59 +0100 Subject: [PATCH] Derive Eq for Term for performance Eq requires reflexivity, Arc uses that fact to optimize the equality check by first comparing the pointers. Unifying deep trees that might use sharing, this could potentially give a performance benefit by getting an early out in a deep tree. --- src/term.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/term.rs b/src/term.rs index 5a7f80f..a9beca7 100644 --- a/src/term.rs +++ b/src/term.rs @@ -3,7 +3,7 @@ use std::{fmt, sync::Arc}; #[derive(Clone, Copy, PartialEq, Eq, Hash)] pub struct Var(pub(crate) u32); -#[derive(Clone, PartialEq)] +#[derive(Clone, PartialEq, Eq)] pub enum Term { Var(Var), Pair(Arc, Arc), -- 2.43.2