Skip to content

Commit 71fdc90

Browse files
authored
Merge pull request rails#47428 from fatkodima/optimize-schema_dumper-ignore
Optimize `SchemaDumper`s check for ignored tables
2 parents e9cb3c7 + a11bef8 commit 71fdc90

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

activerecord/lib/active_record/schema_dumper.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ def format_index_parts(options)
306306
end
307307

308308
def remove_prefix_and_suffix(table)
309+
# This method appears at the top when profiling active_record test cases run.
310+
# Avoid costly calculation when there are no prefix and suffix.
311+
return table if @options[:table_name_prefix].blank? && @options[:table_name_suffix].blank?
312+
309313
prefix = Regexp.escape(@options[:table_name_prefix].to_s)
310314
suffix = Regexp.escape(@options[:table_name_suffix].to_s)
311315
table.sub(/\A#{prefix}(.+)#{suffix}\z/, "\\1")

0 commit comments

Comments
 (0)