Feature #42663
closedOptimize Gantt chart rendering by reducing version-related queries
0%
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