Saturday, March 16, 2013

axlsx vs simple_xlsx

simple_xlsx:

text = getRandomString(15)
serializer = SimpleXlsx::Serializer.new("test2.xlsx") do |doc|
  doc.add_sheet("Report") do |sheet|
    (1...3000).map{
      row = []
      (1...1800).map{
        row.push text
      }
      sheet.add_row row 
    }
  end
end

axlsx:
text = getRandomString(15)
package = Axlsx::Package.new
workbook = package.workbook
workbook.add_worksheet(:name=>"Report") do |sheet|
  (1...3000).map{
    row = []
    (1...1800).map{
      row.push text
    }
    sheet.add_row row 
  }
end
package.serialize("test.xlsx")

Results:
simple_xlsx:
Memory Usage: 17836kb, elapsed: 61.828213seconds.
axlsx:
Memory Usage: 2118256kb, elapsed: 177.089469seconds.

17+Mb vs 2+Gb, 61s vs 177s

File output seems to result in same size: 14+Mb

it would be nice if axlsx could write to file directly instead of serialize in the end.



No comments: