summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-12-20 23:58:31 +0900
committerRandy Morgan <[email protected]>2012-12-20 23:58:31 +0900
commit84f895d717d3528f5af922db7f1c379c1115d7c9 (patch)
tree720a09bbe2fdcfab49dac1e4a5a3317f75ac8682
parent3810e583746152e84acb2c9d5477a9c3e501c7e3 (diff)
downloadcaxlsx-84f895d717d3528f5af922db7f1c379c1115d7c9.tar.gz
caxlsx-84f895d717d3528f5af922db7f1c379c1115d7c9.zip
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.
-rw-r--r--lib/axlsx/workbook/worksheet/col.rb7
1 files changed, 6 insertions, 1 deletions
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