Hard Gem Sheet Unbearably Slow on Ruby 1.9.2

I am creating an Excel parser for my data command, and I came across something like a problem with Spreadsheet 0.6.5.1.

In Ruby 1.9.2, using the Spreadsheet.open method will immediately move up to 700 m-1.3 g of memory and always remain there even on small (1 sheet, 300 lines) books. Meanwhile, in Ruby 1.8.7, Spreadsheet.open is fast and flawless.

Right now I'm doing a lot of work in irb so that I can control the environment I use only for the basics (rubygems / spreadsheet gem), but I need to end up moving this parser to Rails 3, so installing from 1.8.7 doesn’t is an option.

There is no documentation on this problem or even evidence of other people experiencing this problem. Whenever I interrupt the call to Spreadsheet.open, I leave this spill error every time:

gems / spreadsheet-0.6.5.1 / lib / spreadsheet / worksheet.rb: 181: in 'call'

I would like the monkey to not fix it, or dive right into the gem to crack the permit. Has anyone else experienced this issue? Or something like that?

+3
source share
3 answers

Modify the GC and see what this fixes:

For REE:

export RUBY_HEAP_MIN_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=1000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=1000000000
export RUBY_HEAP_FREE_MIN=500000

Something similar should work on 1.9.x, YMMV.

With these settings, 25k rows outperform export using a spreadsheet, went from 10 + minutes to ~ 2 minutes for us.

+2
source

:

  • Rails 3 1.8.7:

    Ruby 1.8.7 Ruby 1.9.2

  • , , . , .

0

It works great if you are not using IRB

When testing in IRB use this:

2.1.0: 003> book = Spreadsheet.open 'myfile.xls'; zero

=> nil

0
source

Source: https://habr.com/ru/post/1788605/


All Articles