datasheet: Avoid reading a given row more than necessary in source_read(). 20130625010510/pspp 20130626010503/pspp
authorBen Pfaff <blp@cs.stanford.edu>
Tue, 25 Jun 2013 06:07:12 +0000 (23:07 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Tue, 25 Jun 2013 06:07:12 +0000 (23:07 -0700)
commitd0f2ab98f2b05a4641cb0d1d042fbe2ad89444aa
treeaa15ac3f05ea28f2f2a2b0181b00a0584600caf8
parentbd981ce2f73ef902f90362913c8cac741f86e1e7
datasheet: Avoid reading a given row more than necessary in source_read().

The datasheet casereader uses datasheet_get_row(), which calls rw_case(),
which until this commit called source_read() for every column.  The latter
was expensive if casereader_peek() actually copied data for a whole large
row.  For a datasheet with N columns, all from a single backing source,
the upshot was that datasheet_get_row() took O(N**2) time.

This commit fixes the problem in the common case by reading as many columns
as possible from a given source in a single call to source_read().

Bug #33260.
src/data/datasheet.c