pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tower.[ch]


From: John Darrington
Subject: tower.[ch]
Date: Sat, 22 Nov 2008 08:46:50 +0900
User-agent: Mutt/1.5.18 (2008-05-17)

Per my discussion with Ben on irc.

Currently, there's a performance issue with the variable/data sheet
implementation, as reported by bug #24726.

The problem manifests itself when redrawing the screen when a dataset
when a large number of variables is involved, and the data sheet has
been scrolled a long way to the right.

The columns of the datasheet are, in general, of non-uniform width.
When redrawing (part of) the datasheet, it's necessary to be able to
lookup the starting pixel of a column.  This value isn't constant,
because columns can be inserted an deleted at random positions.
Currently, this is "solved" by this code in gsheet-column-iface.c

gint
sheet_column_start_pixel(const GSheetColumn *geo, glong col)
{
 gint i;
 gint start_pixel = 0;
 g_return_val_if_fail (G_IS_SHEET_COLUMN (geo), -1);
 g_return_val_if_fail (col <
                      g_sheet_column_get_column_count(geo),-1);
 for ( i = 0 ; i < col ; ++i )
  {
    /* currently this conditional is always true */
    if ( g_sheet_column_get_visibility(geo, i)) 
      start_pixel += g_sheet_column_get_width(geo, i);
  }
 return start_pixel;
}


Clearly this operates in time O(n) which is unacceptable.


Since the situation is similar to the "pile of books" analogy as
described in the comment in src/libpspp/tower.h,  I thought I could use
that.  However, there doesn't seem to be any way 1) to get a
tower_node by index; or 2) given a tower_node (or index), find out how
far from the "ground level" this node starts.

If tower.[ch] can be made to do this in less than linear time, then I
think we can use this to make operations on the datasheet much faster.


J'



-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.


Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]