Project

General

Profile

Actions

Feature #9952

closed

Optimize object allocations in CSV::Row

Added by avit (Andrew Vit) over 10 years ago. Updated over 10 years ago.

Status:
Closed
Target version:
[ruby-core:63215]

Description

I'm seeing a large number of unnecessary array allocations where CSV zips headers & field values together for each row.

  1. We can reverse the zipped arrays in-place instead of re-allocating dup arrays.
  2. We can completely skip the reverse-zip remapping iteration when the number of headers and fields match (probably the common case).

This tiny patch should eliminate one extra temporary array object for every table cell, and saves some unnecessary looping.


Files

csv-20140618.patch (497 Bytes) csv-20140618.patch Optimization for CSV Row avit (Andrew Vit), 06/18/2014 08:46 AM

Updated by nagachika (Tomoyuki Chikanaga) over 10 years ago

  • Status changed from Open to Assigned

Updated by Glass_saga (Masaki Matsushita) over 10 years ago

  • Tracker changed from Bug to Feature
  • Assignee changed from JEG2 (James Gray) to Glass_saga (Masaki Matsushita)
  • Target version set to 2.2.0
Actions #3

Updated by Anonymous over 10 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

Applied in changeset r47663.


  • lib/csv.rb: avoid unnecessary object allocations.
    patch is from Andrew Vit. [ruby-core:63215] [Feature #9952]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0