Project

General

Profile

Actions

Feature #42663

closed

Optimize Gantt chart rendering by reducing version-related queries

Added by Go MAEDA 7 days ago. Updated 3 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Performance
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

The attached patch for lib/redmine/helpers/gantt.rb optimizes the rendering of the Gantt chart by reducing unnecessary version-related queries. Specifically, it avoids repeated loading of the Issue#fixed_version association by using fixed_version_id, caches the results of the project_versions and version_issues methods, and simplifies the logic used to determine whether an issue has child issues assigned to the same version and project.

This change significantly improves performance when rendering Gantt charts for projects with many issues and versions.

For example, in a project with approximately 1,000 issues and 20 versions, rendering the Gantt chart via GanttsController#show showed the following improvement:

Before applying the patch:

Completed 200 OK in 6531ms (Views: 6485.4ms | ActiveRecord: 29.8ms (813 queries, 671 cached) | GC: 306.0ms)

After applying the patch:

Completed 200 OK in 1270ms (Views: 1230.5ms | ActiveRecord: 26.3ms (170 queries, 48 cached) | GC: 149.2ms)

Files

optimize-gantt-rendering.patch (2.26 KB) optimize-gantt-rendering.patch Go MAEDA, 2025-05-03 10:55
Actions

Also available in: Atom PDF