Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-7474

[Ruby] Save CSV files faster

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 0.16.0
    • Ruby

    Description

      Hi developers

      Saving Arrow::Table in CSV format may be slow.

      Ad hoc benchmarks...

       

       
      require 'arrow'
      require 'csv'
      require 'gr/plot'
      t = Arrow::Table.load('some_nice.tsv', format: :csv, delimiter: "\t".ord)
      n = 1.step(1000, 100).to_a
      arrow_save_times = []
      csv_save_times = []
      n.each do |i|
       t2 = t.slice(0, i)
      start = Time.now
       t2.save('test.csv')
       arrow_save_times << p(Time.now - start)
      t2 = t.raw_records
      start = Time.now
       CSV.open('test2.csv', 'w') do |csv|
       t2.each do |r|
       csv << r
       end
       end
       csv_save_times << p(Time.now - start)
      end
      GR.stem([n, arrow_save_times], [n, csv_save_times],
       labels: ["arrow", "CSV"], xlabel: "lines", ylabel: "time", location: 2)
      GR.savefig("arrow.png")
      gets
      

       

       

      Attachments

        1. arrow.png
          130 kB
          kojix2

        Issue Links

          Activity

            People

              kou Kouhei Sutou
              kojix2 kojix2
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h