felixbuenemann / xlsxtream

Streaming & Fast XLSX Spreadsheet Writer for Ruby
MIT License
216 stars 38 forks source link

optimize XML serialization #55

Open ThomasSevestre opened 2 years ago

ThomasSevestre commented 2 years ago

This PR improves performance of XML serialization :

This has a visible impact in our application using ActiveRecord. I have a 15% overall gain.

I'm using this script to benchmark :

# require "active_support/all"
require "benchmark"
module Xlsxtream
  n = 500000
  Benchmark.bm do |x|
    x.report { for i in 1..n; Row.new(['foo', nil, 23, 'foo', nil, 23, 'foo', nil, 23, 'foo', nil, 23], 1).to_xml; end }
  end
end