DataSource: DataSet vs List(Of T)

Posted by: p.feenstra on 31 March 2025, 5:17 am EST

    • Post Options:
    • Link

    Posted 31 March 2025, 5:17 am EST

    Using FpSpread 15.0

    After some testing i found out that working with a dataset is much more efficient with data than with a List(Of T)

    Loading a List(Of T) takes at least 15% extra time.

    Interacting with data (via GetVaue() and SetValue()) of individual cells takes about twice as much time as with a dataset.

    Can you explain why this is the case or am i doing something wrong.

    Regards Piet

  • Posted 1 April 2025, 2:59 am EST

    Hi,

    We created a sample application that loads list of 50k items into the FpSpread control. It took approximately 150 milliseconds to load, which seems ok to us. Kindly refer ListBind.zip.

    fpSpread1.ActiveSheet.AsWorksheet().DataManager.DataSource = Product.GetProducts(50000);  // setting list of 50000 items as the control datasource

    In case the issue still persists, then please update the attached sample based on your use-case. This will help us replicate the issue on our end for further investigation.

    Thanks & regards,

    Aastha

  • Posted 2 April 2025, 4:52 am EST

    Hi Aastha,

    unfortunately I can’t load your example (missing Framework 8 and Core)

    However, the problem is not so much the loading but the interaction with the data. Maybe you can create this example yourself as a Dataset. Then you can compare one and the other. (at least expand the properties to 100)

    I myself work with “.ActiveSheet.DataSource =…” and not with “.ActiveSheet.AsWorksheet().DataManager.DataSource =…”. Does that make a difference?

    The question remains:

    Is it true that a List(Of T) should be just as fast as a Dataset or are there disadvantages?

    Regards Piet

  • Posted 3 April 2025, 1:39 pm EST

    Hi,

    When you use list of objects as data source, Spread uses reflection to get value of object’s properties. Using reflection affects to performance much. This is the reason of comparatively low performance, and it is the intended behavior.

    Unfortunately, there is no solution to make it work as fast as DataSet/DataTable.

    Thanks & regards,

    Aastha

  • Posted 4 April 2025, 2:32 am EST

    Hi Aastha,

    So i’m correct in my observation.

    Regards,

    Piet

  • Posted 7 April 2025, 12:09 am EST

    Hi Piet,

    Yes, your observation was correct.

    Regards,

    Aastha

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels