summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/workbook/worksheet/worksheet.rb
diff options
context:
space:
mode:
authorPaul Kmiec <[email protected]>2023-05-13 11:00:38 -0700
committerPaul Kmiec <[email protected]>2023-05-15 16:58:24 -0700
commit447b2522bc4a06c8436e708eae40cf7244dc0ec4 (patch)
tree764d08ac803bd6c1dc3065823da3f5b0cc39ef96 /lib/axlsx/workbook/worksheet/worksheet.rb
parentaf8360755fe21f4e9d30e943ba0b2be3c0128d28 (diff)
downloadcaxlsx-447b2522bc4a06c8436e708eae40cf7244dc0ec4.tar.gz
caxlsx-447b2522bc4a06c8436e708eae40cf7244dc0ec4.zip
Only define @escape_formulas in cell if it is different from worksheet
The benchmarks showed that validate_boolean is called 200_005 times and almost all of those are to validate escape_formulas passed into cell. In this commit the worksheet does not pass in its escape_formulas value, avoiding validate_boolean, and instead the cell asks the worksheet for value when needed. Now validate_boolean is called 5 times in benchmarks.
Diffstat (limited to 'lib/axlsx/workbook/worksheet/worksheet.rb')
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet.rb1
1 files changed, 0 insertions, 1 deletions
diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb
index 960f33b3..21c53409 100644
--- a/lib/axlsx/workbook/worksheet/worksheet.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet.rb
@@ -429,7 +429,6 @@ module Axlsx
# Allowing user generated data to be interpreted as formulas can be dangerous
# (see https://www.owasp.org/index.php/CSV_Injection for details).
def add_row(values = [], options = {})
- options[:escape_formulas] = escape_formulas if options[:escape_formulas].nil?
row = Row.new(self, values, options)
update_column_info row, options.delete(:widths)
yield row if block_given?