The runtime on this isn't horrible, but it is still linear in the number of columns (though not so linear in the number of rows).
Considering you are looping over the rows, how do you expect your run time to not be at least linear in the number of rows?

Also, considering you are reading in the entire line, you cannot really beat any linearity on the number of columns. In fact, reading in your entire file makes the program at least linear in the size of the data - and considering that each row and each column is represented by at least one character in the data, your running time is at least linear in the product of the number of rows and columns.

Not that this is bad. All I want to point is that being linear in the number of columns is actually very typical for any program reading tabular data.


In reply to Re: CSV Columns: Friend or foe? by JavaFan
in thread CSV Columns: Friend or foe? by dekul

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.