From 84f895d717d3528f5af922db7f1c379c1115d7c9 Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Thu, 20 Dec 2012 23:58:31 +0900 Subject: Removed validation for col#width This needs to be smarter and only validate when the user supplies a value directly. 10% performance increase just by removing the validataion as this gets updated every time we set a single cell value. --- lib/axlsx/workbook/worksheet/col.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/axlsx/workbook/worksheet/col.rb b/lib/axlsx/workbook/worksheet/col.rb index a2658724..42997a2b 100644 --- a/lib/axlsx/workbook/worksheet/col.rb +++ b/lib/axlsx/workbook/worksheet/col.rb @@ -104,7 +104,12 @@ module Axlsx # @see Col#width def width=(v) - Axlsx.validate_unsigned_numeric(v) unless v == nil + # Removing this validation make a 10% difference in performance + # as it is called EVERY TIME A CELL IS ADDED - the proper solution + # is to only set this if a calculated value is greated than the + # current @width value. + # TODO!!! + #Axlsx.validate_unsigned_numeric(v) unless v == nil @custom_width = @best_fit = v != nil @width = v end -- cgit v1.2.3