Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
Hi,

I will try and explain everything so that I do not miss out on anything important.

Winform - .NET 4.0 DataGridView
Loading 25000 rows of data which is bound to a Datagridview using BindingSource
Out of a total 50 something columns, 7 columns have encrypted data (Blowfish)
After the data load is complete - looping all rows to decrypt info
This takes a whopping 9 minutes

Help needed to:
Bring the loading time down
Exclusion of any field is not an option
Loading all 25000 is also a requirement

I think I have tried a lot of methods to reach to this point, but I think I need some to figure the last bit out. Some of my friends said they could load data using WPF collections (0.25 million records per minute). I do not know if that's true but this being a VB.NET Winform app - please suggest anything I can try to speed up the application load times.

Many thanks.

What I have tried:

1. Lazyloading - uses a Background worker to decrypt records in datatable. This currently works and helps keep the UI responsive but the user cannot export the data unless the decryption is complete. Takes appox. 8 mins to complete.

2. Hardloading - Using
VB
Parallel.ForEach
looped through all records in Datatable. This completes the job in half the time i.e. 4 mins but the UI becomes unresponsive at times. Also the CPU usage goes to 100%. Used MaxDegreeOfParallelism as a variable but using anything above 2 freezes the GUI.

3. Eagerloading - normally loop through all records in Datatable using
VB
For Each
This takes about 9 mins to complete.
Posted
Updated 10-Apr-17 10:23am

1 solution

Loading 25000 items into a User Interface is just silly. That is the politest way I can put it.

WPF collections? I think your friends are talking rubbish.

How to speed up the load times?

1. You should implement some sort of paging - for example only load the first 40 items until the User presses Page Down

2. Load the data into a .NET collection - for example a List. You may need to create a class that reflects the incoming data.

3. Iterate through the collection not any UI control.

4. Use JIT thinking - only decrypt when attempting to display - so only 40 records at a time.

Best advice would be paging on a worker thread.

By the way - There is never any good reason to load that many rows into a UI component.
 
Share this answer
 
Comments
kasbaba 12-Apr-17 10:40am    
Thank you for your answer. I agree loading those many items is not ideal. As I mentioned, it was a requirement. Thankfully, we found a way and it was load the data in batches and use Merging to allow the whole operation to work without overloading system resources.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900