Home Forums WinForms controls Xceed Grid for WinForms Very Large Dataset

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #13954 |

    Is there any way to optimize the amount of memory used? I have a dataset with 38 columns of strings and anywhere from 50-80K of rows. There is no editting, just viewing. Obviously, it uses more RAM than most of our machines have.

    I have tried the following:
    – put each row into a custom class
    * Used the most memory

    – put all data in a dataset
    * used less memory and was the fastest to display (still too much RAM)

    – put all data in a two dimension array of strings
    * used the least RAM, but took forever to display I am using BeginInit and EndInit on the grid.

    Any ideas?

    Thanks.

    Imported from legacy forums. Posted by Steve0212 (had 6611 views)

    Odi [Xceed]
    Spectator
    Post count: 426

    Have you considered trying the technique used by the DataBinding sample, that is, using Dynamic Data Reading to avoir loading the complete dataset in memory?

    Imported from legacy forums. Posted by Odi [Xceed] (had 275 views)

    User (Old forums)
    Member
    Post count: 23064

    No – I will give that a shot. .NET does not seem to be very effiecient. The file I am loading is 17 MB and by the time I load the dataset (not even set the grid yet), I am using over 500 MB of RAM. You would think they could store it a little better.

    Imported from legacy forums. Posted by Steve0212 (had 496 views)

    User (Old forums)
    Member
    Post count: 23064

    Instead of data binding, you could try filling the grid manually. Like this:<code>Xceed.Grid.Collections.DataRowList rows = grid.DataRows;
    grid.BeginInit();
    <i>for each record</i>
    {
    Xceed.Grid.DataRow newRow = rows.AddNew();
    <i>for each field</i>
    {
    newRow.Cells[<i>fieldIndex</i>].Value = <i>fieldValue</i>;
    }
    }
    grid.EndInit();</code>

    Imported from legacy forums. Posted by Tommy (had 215 views)

    User (Old forums)
    Member
    Post count: 23064

    I tried that and it was very slow. I found another of your posts witht he following code:

    public class MyDataRow : Xceed.Grid.DataRow {
    public MyDataRow() {}
    public MyDataRow(MyDataRow template):base(template) {}
    protected override Xceed.Grid.Row CreateInstance() { return new MyDataRow(this); }
    protected override Xceed.Grid.Cell CreateCell(Xceed.Grid.Column parentColumn){ return new MyDataCell(parentColumn); }
    protected override void PaintBackground(Xceed.Grid.GridPaintEventArgs e) {
    using (Brush b = new SolidBrush(GetBackColorToPaint()))
    e.Graphics.FillRectangle(b, e.ClientRectangle);
    }
    }

    public class MyDataCell : Xceed.Grid.DataCell {
    public MyDataCell() {}
    public MyDataCell(MyDataCell template):base(template) {}
    public MyDataCell(Xceed.Grid.Column parentColumn):base(parentColumn) {}
    protected override Xceed.Grid.Cell CreateInstance() { return new MyDataCell(this); }
    protected override void PaintBackground(Xceed.Grid.GridPaintEventArgs e) {
    // do nothing
    }
    }

    How do I do an rows.AddNew() with the inherited datarow class as I get a “Specified Cast is not valid” with the code below?
    MyDataRow newRow = (MyDataRow)HeaderGrid.DataRows.AddNew();

    Thanks.

    Imported from legacy forums. Posted by Steve0212 (had 362 views)

    User (Old forums)
    Member
    Post count: 23064

    You have to set the <b>DataRowTemplate</b> of your grid to an instance of your custom DataRow. That instance is then used as a template to create new DataRows.<code>HeaderGrid.DataRowTemplate = new MyDataRow();

    MyDataRow newRow = HeaderGrid.DataRows.AddNew() as MyDataRow;</code>

    Imported from legacy forums. Posted by Tommy (had 313 views)

    User (Old forums)
    Member
    Post count: 23064

    Another thing: one of the next versions of Xceed.Grid will have a virtual mode that allows the fast displaying of very large datasources. See <a href=”http://www.xceedsoft.com/email/02-08-2005/email.asp?nom=developer”>the newsletter of August</a> (scroll down to the paragraph <i>”Speaking of Grid for .NET…”</i>).

    Imported from legacy forums. Posted by Tommy (had 260 views)

    Odi [Xceed]
    Spectator
    Post count: 426

    Hi Tommy,

    Just to let you know, that “major new capability not currently found in any other grid” that we have been working on is running a little behind schedule. Xceed Grid for .NET v3.0 is delayed slightly and will be ready at the end of the year, not in Autumn as the newsletter announced.

    Odi

    Imported from legacy forums. Posted by Odi [Xceed] (had 382 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks for the info, Odi.
    You know, I would be a bit more excited if I actually knew what that <i>major new capability not currently found in any other grid</i> was. But I understand you can’t reveal that yet. There is a lot of competition in this market, and every feature you have that others don’t have is a big advantage.

    I really look forward to the virtual mode. In one of our current applications, we use the GridControl to display tables with tens of columns and thousands of rows, and these tables keep growing and growing, so these grids are getting a bit slow. I’ve extended and optimized the Xceed.Grid classes quite a bit, and I think I’m currently pushing the boundaries. Virtual mode will allow me to greatly increase performance for those large tables.

    Imported from legacy forums. Posted by Tommy (had 294 views)

    User (Old forums)
    Member
    Post count: 23064

    I’ve got the very same problem. I’ve not tried implementing the DynamicBindingList, but will try that right away. I noticed it’s read only, will adding write support implicate performance in any way?

    Also, I noticed the sample used aprox 900 rows, where memory usage on my machine rose to about 35 mb. If I ten fold that (9000 rows), what kind of memory hit can I expect?

    I too anxiously await virtual mode. I was actually wondering just last night if the grid supported it, I guess not.

    Imported from legacy forums. Posted by macke (had 613 views)

    User (Old forums)
    Member
    Post count: 23064

    I’ve got a follow up question to this. Is there any samples which implements such page caching on a typed dataset, or any docs anywhere?

    Imported from legacy forums. Posted by macke (had 7709 views)

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.