Skip to content

Commit

Permalink
Removed validation for col#width
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
randym committed Dec 20, 2012
1 parent 3810e58 commit 84f895d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/axlsx/workbook/worksheet/col.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ def style=(v)

# @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
Expand Down

0 comments on commit 84f895d

Please sign in to comment.