简体   繁体   English

Infragistics Ultragrid-使用PerformAutoResize降低性能

[英]Infragistics Ultragrid - slow performance with PerformAutoResize

I have badly performing code that uses Ultragrid, but running a visualisation analysis using D3.js on the trace output I discovered that grid__InitializeRow was calling itself multiple times. 我使用Ultragrid的代码执行得很差,但是在跟踪输出上使用D3.js运行可视化分析时,我发现grid__InitializeRow多次调用自身。

Trigger created by: this.grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(this.grid_InitializeRow); 触发器创建者: this.grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(this.grid_InitializeRow);

Problem starts with this code: 问题从以下代码开始:

column.PerformAutoResize(PerformAutoSizeType.AllRowsInBand, true)

Searching the web I could not find information on this, but have found some possible contenders - calling any of these appears to call initialise row: 在网上搜索时,我找不到有关此信息,但是找到了一些可能的竞争者-调用其中任何一个似乎都会调用初始化行:

  • grid.DataSource grid.DataSource
  • grid.Rows.Band.Layout.Bands grid.Rows.Band.Layout.Bands
  • column.performAutoResize column.performAutoResize

Questions 问题

  1. Is there documentation on this anywhere 是否在任何地方都有相关文档
  2. Can I disable the trigger somehow temporarily 我可以暂时以某种方式禁用触发器吗

Thanks in advance 提前致谢

Found the answer via Infragistics forums : 通过Infragistics论坛找到了答案:

Calling column.PerformAutoResize(PerformAutoSizeType.AllRowsInBand, true) triggers a rebind from the datasource, which in turn triggers initialise_row . 调用column.PerformAutoResize(PerformAutoSizeType.AllRowsInBand, true)会触发来自数据源的重新绑定,进而触发initialise_row

As the resize was called multiple times (once per column per band) the rebinds got out of hand. 由于多次调用了重新调整大小(每条带每列一次),因此重新绑定变得一发不可收拾。

For information we also had the following problems. 作为参考,我们还存在以下问题。 With a year's data it was taking 2 minutes to render: 根据一年的数据,渲染需要2分钟:

  • It was a huge grid and the cells were being styled individually. 这是一个巨大的网格,单元正在单独设置样式。 Changing to using an Appearance library / factory shaved 40s off the load time 更改为使用外观库/工厂将加载时间缩短了40秒
  • Database tuning shaved another 40s off 数据库调优又节省了40秒钟
  • Changing the way custom totals rows were calculated shaved 15s off (by using total var instead of updating cell) 更改自定义总计行的计算方式可减少15秒(通过使用total var而不是更新单元格)
  • AutoResize was a force multiplier - made all the other issues worse. AutoResize是倍增力-使所有其他问题变得更糟。 Fixing that shaved more time off. 解决这个问题可以节省更多时间。

Hope this helps others with simiar problems 希望这可以帮助其他遇到类似问题的人

I couldn't make "PerformAutoResize" perform adequately. 我无法充分发挥“ PerformAutoResize”的作用。 It would take 10s of seconds. 这将需要10秒钟的时间。 So in the end I decided to roll my own, which is limited to our particular use of the grid config which only displays text in cells (as opposed to sub-controls), using the Graphics.MeasureString function for each grid cell. 因此,最终我决定自己动手,这仅限于我们对网格配置的特殊使用,该配置仅在每个网格单元中使用Graphics.MeasureString函数,从而仅在单元格(而不是子控件)中显示文本。

About 40 lines of code and reduced time taken to 0.4 secs for a 600 x 20 grid. 对于600 x 20的网格,大约需要40行代码,并将时间减少到0.4秒。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM