开发者

datagridview performance loading data

开发者 https://www.devze.com 2022-12-23 15:13 出处:网络
I\'ve got collection of 50k records, and i get it in one second, but loadi开发者_如何学Cng it to database take about 10 seconds.

I've got collection of 50k records, and i get it in one second, but loadi开发者_如何学Cng it to database take about 10 seconds.

How to increase loading data?

Everything what I make now is:

dgvCars.DataSource=cars;


Data-binding 50k rows is going to take a while. I would first look at reducing the data volume (what is any user really going to do with 50k rows). But otherwise: "virtual mode" (what | how).

Edit; I suspect most of the time is being spent doing things like building control trees and other structures, but it might be that the reflection-based member-access is slowing this down; if so, maybe HyperDescriptor could help (simply by adding a 1 line call in your code to enable it for the associated type).


Its typically more work, but you might look into asynchronous querying. Its more work, but as you can get a subset batch of data back, display it to the grid. Then on continued background results getting returned, just add to the underlying table being displayed in the grid on an as needed basis. Don't worry about pulling the full 50k records down.

0

精彩评论

暂无评论...
验证码 换一张
取 消