diff options
author | Vipul A M <vipulnsward@gmail.com> | 2016-04-18 23:59:27 +0530 |
---|---|---|
committer | Vipul A M <vipulnsward@gmail.com> | 2016-04-18 23:59:27 +0530 |
commit | 1a9eb19ac4eac90b514eb3572399a9875aa30beb (patch) | |
tree | 5ba51168828ec6f10d6f78c1429a289c952e182e /activerecord | |
parent | b39131e8bdb65a9ee51e49d7fe8f058e702e173b (diff) | |
download | rails-1a9eb19ac4eac90b514eb3572399a9875aa30beb.tar.gz rails-1a9eb19ac4eac90b514eb3572399a9875aa30beb.tar.bz2 rails-1a9eb19ac4eac90b514eb3572399a9875aa30beb.zip |
Don't create new arrays when trying to compute non_empty_predicates for where clause predicate. Get a 3-4% improvement in AST generation.
Perf compare: https://gist.github.com/vipulnsward/7e4e9ecb157e574002313249a7969c82
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/relation/where_clause.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/where_clause.rb b/activerecord/lib/active_record/relation/where_clause.rb index 2c2d6cfa47..89396b518c 100644 --- a/activerecord/lib/active_record/relation/where_clause.rb +++ b/activerecord/lib/active_record/relation/where_clause.rb @@ -158,8 +158,9 @@ module ActiveRecord end end + ARRAY_WITH_EMPTY_STRING = [''] def non_empty_predicates - predicates - [''] + predicates - ARRAY_WITH_EMPTY_STRING end def wrap_sql_literal(node) |