Improve performance of my IlvGanttChart and IlvScheduleChart

Article ID: 2197
Last updated: 28 May, 2018
Article ID: 2197
Last updated: 28 May, 2018
Revision: 3
Views: 895
Posted: 21 Apr, 2005
by Dean J.
Updated: 28 May, 2018
by Gargani A.

Question

How can I increase the performance of my IlvGanttChart and IlvScheduleChart?

Answer

  • To reduce the Gantt model creation time you can create your IlvGanttModel object and then add all your activities/resources/constraints/reservations to your Gantt model. At that time, the Gantt model is on its own, so it does not contain any external listeners. After adding all your activities/reservations you can call the IlvHierarchyChart.setGanttModel() method to bind the Gantt model to the chart.
  • To make bulk updates to a Gantt model that is already bound to a Gantt chart, you can temporarily unbind it from the Gantt chart (setGanttModel(null)) and rebind it later (setGanttModel(model)) after having updated all your activities/resources/constraints/reservations.
    • Note that by doing this, the expand/collapse state of the rows in the chart will be lost.
    • Note that the setAutoCalcTimeIntervalFromChildren optimization described below can still be applied for additional performance benefit.
  • In JViews 6.0 and later, an alternative optimization can be used to make bulk updates to a Gantt model that is already bound to a Gantt chart. Enclose the data model updates inside an IlvManager redraw session. For example:

    IlvManager sheetMgr = chart.getGanttSheet().getManager();
    sheetMgr.initReDraws();
    ... update the data model ...
    sheetMgr.reDrawViews();

    Notes:

    Manager redraw sessions can be used to improve the performance of any large set of operations that affect the display of the Gantt sheet, not just for data model updates. For example, expanding or collapsing a large set of rows, and so on.

    • Manager redraw sessions can be applied to JViews 5.5 and earlier, but will have little effect good or bad.
    • In JViews 6.5, the begin/endRedrawSession methods are introduced. These provide a simpler and more flexible way of accomplishing the same thing. For example:

      IlvGanttSheet sheet = chart.getGanttSheet();
      sheetMgr.beginRedrawSession(true);
      ... update the data model ...
      sheet.endRedrawSession();

    • The setAutoCalcTimeIntervalFromChildren optimization described below can still be applied for additional performance benefit.
  • When emptying an IlvScheduleChart, always prefer unbinding the model (setGanttModel(null)) to removing the root resource (or the root activity in case of an IlvGanttChart). This is faster.
    • Note that both operations might be time-consuming in JViews versions <= 4.0
    • Unbinding the Gantt model might be time-consuming because all the reservation or constraint graphics are removed individually. This causes redundant calculations, updates, and redraws. This issue has been addressed in JViews 5.0 and later.
    • Removing the root resource or activity might be time-consuming because removing a resource or activity from the model causes all its reservations/constraints to fire an event to which the chart responds by removing the corresponding graphic. JViews does not distinguish between reservations/constraints that are independently removed from the data model as opposed to reservations/constraints that are removed because their associated resource/activity is being removed from the data model. This issue has been addressed in JViews 5.0 and later, where new flags posted on the events allow the chart to make the distinction and to optimize the process. Note that if you are using your custom Gantt model implementation, you will need to fire the constraint and reservation removal events with the new methods defined at the IlvAbstractGanttModel level to take advantage of the optimization. The IlvDefaultGanttModel class in JViews 5.0 and later has been updated in order to take advantage of them.
  • Call setAutoCalcTimeIntervalFromChildren(false) for all the ancestors of activities you are adding to the Gantt model. This avoids the parent activities being constantly recalculated with respect to the changes made to their children. If you are populating a large data model and want this flag ultimately set to true, it is usually faster first to disable it for all activities as they are added to the data model (especially for the root). Then, after the data model is populated, iterate over all the activities and reset the flag to true for each.
  • The Schedule chart uses a PRETTY_ACTIVITY_LAYOUT as default. This activity layout can cause the Schedule chart to spend a lot of time arranging the reservation graphics as prettily as possible. You can replace the default activity layout by a SIMPLE_ACTIVITY_LAYOUT by calling the setActivityLayout() method of IlvScheduleChart. This layout algorithm is simpler and more efficient.
  • The usage of the IlvScheduleChart.setReservationCachingEnabled(true) method (available since JViews 3.5) might increase the performance by taking into account only the visible reservations and not the entire set of them.
  • In JViews 4.0 and earlier, avoid using the deprecated (since JViews 3.5) class ilog.views.gantt.IlvTime (this class was removed in JViews 5.0). Use the standard java.util.Date class instead. The ilog.views.gantt.IlvTimeUtil and ilog.views.gantt.IlvTimeScrollUtil classes and their static methods may be useful as well. In JViews 5.5 and later there is also the ilog.views.util.time.IlvCalendarUtil class.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 2197
Last updated: 28 May, 2018
Revision: 3
Views: 895
Posted: 21 Apr, 2005 by Dean J.
Updated: 28 May, 2018 by Gargani A.
Also listed in


Others in this category