Firemonkey和大量数据 [英] Firemonkey and large amounts of data

查看:156
本文介绍了Firemonkey和大量数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚看过Firemonkey的网格实现,结果是它是一个非常简单的实现(只有1800行,对于网格实现来说似乎不是很多)。它几乎没有自定义绘画,而是聚合了很多其他控件 - 这似乎是Firemonkey的做事风格。



例如,每列保留一个数组的控件 - 每个单元格一个。对于具有1,000,000行的正常文本列,网格将在内存中保留1,000,000个编辑控件 - 对我来说似乎有点疯狂。 (编辑:现在,如果这个假设是正确的,现在不太确定,似乎考虑到单元格的可见性,这可能意味着它提供了像虚拟模式,但我不太确定...



我的问题:毫无疑问,Firemonkey的这个组件聚合设计看起来很简单而优雅,但是它的真实数据量与要在网格中显示?我无法想象它的行列表现很好。什么是Firemonkey处理大量数据的方法?



感谢任何输入。

解决方案

FireMonkey网格仅对可见行的数量进行控制。
所以如果你有一个具有10个可见行和3列的网格,它将创建30个单元格控件。
使用10.000个记录填充网格是没有问题的:当您滚动30个单元格控件被重用并映射到新的可见行。



是的:我做了一些测试,因为我们有具有100.000个记录的TMS网格: - )。



如果你使用OnGetCellText(所以不是TStringgrid,这是很慢的记录,特别是TMS网格(基于VCL stringgrid))它非常快(OnGetCellText仅检索可见单元格的数据)。我们使用这种技术结合我们的数据对象(这些已经被加载,所以不需要再次用字符串值填充网格的每个单元格...),TMS和FMX网格都是非常快的,有100.000条记录或更多!


I just had a look at Firemonkey's grid implementation and it turns out that it is a very simple implementation (only 1800 lines which seems not much for a grid implementation). It does almost no custom painting but does instead aggregate a lot of other controls - which seems to be the Firemonkey style of doing things.

For example, each column keeps an array of controls - one for each cell. For a normal text column with 1,000,000 rows, the grid would keep 1,000,000 edit controls in memory - which seems a little crazy to me. (EDIT: not so sure now if that assumption is right. It seems to take the visibility of cells into account, which could mean it does provide something like a virtual mode, but I'm not quite sure...)

My question: Without any doubt, this component-aggregating design of Firemonkey seems simple and elegant but does it really scale well with the amount of data that has to be displayed in the grid? I cannot imagine that it does perform well with a large number of rows. What is the Firemonkey way of handling large amounts of data?

Thanks for any input.

解决方案

The FireMonkey grid only has controls for the number of visible lines. So if you have a grid with 10 visible rows and 3 columns, it will create 30 cell controls. Filling the grid with 10.000 records is no problem: when you scroll the 30 cell controls are reused and mapped to the new visible rows.

And yes: I did some tests with this because we have TMS grids with 100.000 records :-).

If you use OnGetCellText (so not TStringgrid, which is very slow with lots of records, especially TMS grid (based in VCL stringgrid)) it is very fast (OnGetCellText only retrieves data of visible cells). We use this technique in combination with our data objects (these are already loaded, so no need to fill each cell of the grid with the string value again...) and both TMS and FMX grids are very fast with 100.000 records or more!

这篇关于Firemonkey和大量数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆