Delayed Update of Spread

Posted by: hitesh-fp on 8 September 2017, 1:18 pm EST

  • Posted 8 September 2017, 1:18 pm EST


    We are using Spread for an application that receives several (>2000) updates a seconds. We notice that at updates >400 the application slows down condsiderably. One of the solutions that worked in another project (using another grid control) was to do batch updates, i.e. consume all the incoming messages but update the grid only twice a second. This scales really nicely.

    The way it was implemented was that a DataTable was subclassed and the raising the Changed event periodically i the data has changed.

    We are heavily using the DefaultSheetDataModel so don't want to rewrite the application to use DataTable. But will prefer to subclass the DefaultSheetDataModel to achieve similar results.

    The one way I could achieve is

    Private Sub TimerElapsed(ByVal source As Object, ByVal e As Timers.ElapsedEventArgs)
    SyncLock SyncRoot
    If isChanged Then
    MyBase.OnChanged(New FarPoint.Win.Spread.Model.SheetDataModelEventArgs(0, 0, -1, -1, FarPoint.Win.Spread.Model.SheetDataModelEventType.ModelUpdated))
    isChanged = False

    End If
    End SyncLock
    End Sub

    But I don't think this is efficient as it is updatign the whole grid and not just the rows/cells that have changed.
    Is there a better way, or am I barking up the wrong tree and there is a better way to handle such large updates. Especially is it possible to update (repaint) only the visible cells and ignore the vast majority that are not in the ViewPort. Or does the Spread already do this?


  • Replied 8 September 2017, 1:18 pm EST


    Spread is updating only the visible part when a change is made. There are some steps you can do to make the Spread peform faster. First, if you are not using StickyNotes, I would suggest turning off AutoUpdateNotes property. If you are not provising undo/redo capabilities, you can turn off the AllowUndo property. If you are not using formulas, you can turn off the AutoCalculation property. If you are using GeneralCellTypes, make sure you are using the Value property to add/modify data in the cells. And one of the last things, you can turn off the painting by calling the SuspendLayout method and then call ResumeLayout method to resume the painting.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels