Recent

Author Topic: Limit to number of cells in stringgrid in wince  (Read 6447 times)

polypress

  • Jr. Member
  • **
  • Posts: 91
Limit to number of cells in stringgrid in wince
« on: September 10, 2010, 09:38:53 am »
I understand from other sources that lazarus may commit a default amount of memory to each cell in a stringgrid. Is there any way to control this amount of memory (by cell or by column). I have 500,000 cells which require data from various files, some of which only need 1, 2, 4, 5 or 10 characters of data, while others need up to 30 characters (in the longer term, with new sources of data, this will need to increase to 60 characters). Currently, the applications crash when more than 300,000 cells are used. If I use more data but in fewer cells, the programs do not crash, suggesting that the default cell memory allocation may be true.

Any ideas?

I have tried using kgrids, but that will not install in my latest version of lazarus (0.29).

Regards

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4570
  • I like bugs.
Re: Limit to number of cells in stringgrid in wince
« Reply #1 on: September 10, 2010, 02:07:33 pm »
How long does it take to fill those 300 000 cells? I guess it takes a long time.
Is there any error message before the crash?
"wince" - are you doing this in some resource limited pocket machine?

I am afraid you will not get good performance using TStringGrid.
Try VirtualTreeView instead! It works as a flat table as well.
It is extremely fast. Adding 500000 nodes happens in "no time" and data is fetched on-demand by event handlers.

I have a nice optimized in-memory DB for both table- and tree-data, connecting to VirtualTreeView, but I haven't yet published it. If you are interested please tell me.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

JD

  • Hero Member
  • *****
  • Posts: 1905
Re: Limit to number of cells in stringgrid in wince
« Reply #2 on: September 10, 2010, 03:06:36 pm »
VirtualTreeView is what you need. I seen it handle 1000000 rows at breathtaking speeds.

I would however advise you to revisit the design of your application. Ask yourself the following questions

Do the users need to interact with 300000 rows in a grid at the same time?

How fast will data retrieval be on a network if users are connected to a network?

In addition to using VirtualTreeView, I suggest you look into the idea of data paging. Here instead of retrieving all 300000 rows, retrieve say the first 100 rows & give users the option of retrieving the next 100 rows & so on (i.e browsing through the dataset 100 rows at a time). Your application will be faster & look modern since this is the same principle that web searching uses.

Cheers & good luck,

 :D
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

jesusr

  • Sr. Member
  • ****
  • Posts: 496
Re: Limit to number of cells in stringgrid in wince
« Reply #3 on: September 11, 2010, 01:37:11 am »
I understand from other sources that lazarus may commit a default amount of memory to each cell in a stringgrid. Is there any way to control this amount of memory (by cell or by column). I have 500,000 cells which require data from various files, some of which only need 1, 2, 4, 5 or 10 characters of data, while others need up to 30 characters (in the longer term, with new sources of data, this will need to increase to 60 characters). Currently, the applications crash when more than 300,000 cells are used. If I use more data but in fewer cells, the programs do not crash, suggesting that the default cell memory allocation may be true.

Any ideas?

I have tried using kgrids, but that will not install in my latest version of lazarus (0.29).

Regards

can you prepare or make available a test application in order to see what can be made?.  If you have your data already in some data structure you may want to use TDrawGrid instead of TStringGrid.

 

TinyPortal © 2005-2018