From 707554e6a8b125cf6bdbc9214be4407ba4b624b3 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 30 Aug 2013 15:44:10 +1000 Subject: [PATCH] Improve performance of #uniq across a large number of nodes --- lib/arel/table.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/arel/table.rb b/lib/arel/table.rb index 5fb1254d17..ef109afe95 100644 --- a/lib/arel/table.rb +++ b/lib/arel/table.rb @@ -124,7 +124,10 @@ Arel 4.0.0 with no replacement. PEW PEW PEW!!! end def hash - [@name, @engine, @aliases, @table_alias].hash + # Perf note: aliases, table alias and engine is excluded from the hash + # aliases can have a loop back to this table breaking hashes in parent + # relations, for the vast majority of cases @name is unique to a query + @name.hash end def eql? other