aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel
diff options
context:
space:
mode:
authorSam <sam.saffron@gmail.com>2013-08-30 15:44:10 +1000
committerSam <sam.saffron@gmail.com>2013-08-30 15:44:10 +1000
commit707554e6a8b125cf6bdbc9214be4407ba4b624b3 (patch)
tree6d0d6614a49403bd80d81658d0f285f73bf7be6e /lib/arel
parent4524c7f8a8225677893e0731f40993de17d4babc (diff)
downloadrails-707554e6a8b125cf6bdbc9214be4407ba4b624b3.tar.gz
rails-707554e6a8b125cf6bdbc9214be4407ba4b624b3.tar.bz2
rails-707554e6a8b125cf6bdbc9214be4407ba4b624b3.zip
Improve performance of #uniq across a large number of nodes
Diffstat (limited to 'lib/arel')
-rw-r--r--lib/arel/table.rb5
1 files changed, 4 insertions, 1 deletions
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