Performance issues and a bug

TeeGrid VCL / FMX for Embarcadero RAD Studio, Delphi, C++ Builder and Lazarus Free Pascal.
Post Reply
stoffman
Newbie
Newbie
Posts: 14
Joined: Wed Dec 29, 2021 12:00 am

Performance issues and a bug

Post by stoffman » Sat Apr 22, 2023 11:16 am

I'm working with a TDataset that contains 100,000 records. I noticed some a performance issue and while resolving it I also noticed a bug.

1. I'm using TZMemTable (zeoslib 8.0) which is a in memory TDataset (i.e. all the records are loaded into the memory)
2. I noticed that every time the grid access the TZMemdataSet, TVirtualDBData.FetchAllRecords is being called. This is clearly not needed.
3. Internally the grid calls FetchAllRecords If Not IBuffered (in TVirtualDBData.InternalRefresh)
4. However! IBuffered can only be set *after* TVirtualDBData is created by TVirtualDBData.Form (so there is at least 1 call for FetchAllRecords)
5. But there is a bug, the grid behaves funny, and scrolling doesn't work because that TVirtualDBData.KnownCount returns *false* when IBuffered is true!

So in-order to make everything works fast I had to change 2 function:
1. TVirtualDBData.KnownCount should return True for IBuffered
2. in TVirtualDBData.From set IBuffered directly (using SetFetchMode calls a Refresh and I didn't have time to check what it does)

Thanks,

I'm using: windows 10, Lazarus 2.2.4, Grid 1.1

Post Reply