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 #1

Updated by Go MAEDA 7 days ago

Sorry, the test results I worte in the description were for the development environment. The results for the production environment are as follows.

Before applying the patch:

Completed 200 OK in 755ms (Views: 708.2ms | ActiveRecord: 41.0ms (1146 queries, 1023 cached) | GC: 51.8ms)

After applying the patch:

Completed 200 OK in 594ms (Views: 534.8ms | ActiveRecord: 52.0ms (155 queries, 51 cached) | GC: 70.7ms)

Actions #2

Updated by Go MAEDA 6 days ago

Tested with 3000 issues and 60 versions:

Before applying the patch:

Completed 200 OK in 1994ms (Views: 1834.1ms | ActiveRecord: 150.6ms (2358 queries, 2100 cached) | GC: 149.9ms)
Completed 200 OK in 1980ms (Views: 1821.2ms | ActiveRecord: 150.0ms (2358 queries, 2100 cached) | GC: 144.4ms)
Completed 200 OK in 1952ms (Views: 1796.6ms | ActiveRecord: 147.8ms (2358 queries, 2100 cached) | GC: 136.0ms)
Completed 200 OK in 1948ms (Views: 1792.8ms | ActiveRecord: 147.2ms (2358 queries, 2100 cached) | GC: 136.9ms)
Completed 200 OK in 1988ms (Views: 1828.0ms | ActiveRecord: 152.8ms (2359 queries, 2100 cached) | GC: 143.7ms)

After applying the patch:

Completed 200 OK in 1196ms (Views: 1051.4ms | ActiveRecord: 141.1ms (327 queries, 130 cached) | GC: 114.8ms)
Completed 200 OK in 1264ms (Views: 1105.9ms | ActiveRecord: 150.2ms (327 queries, 130 cached) | GC: 124.7ms)
Completed 200 OK in 1263ms (Views: 1104.2ms | ActiveRecord: 152.7ms (327 queries, 130 cached) | GC: 125.3ms)
Completed 200 OK in 1233ms (Views: 1076.0ms | ActiveRecord: 148.8ms (327 queries, 130 cached) | GC: 118.3ms)
Completed 200 OK in 1240ms (Views: 1086.2ms | ActiveRecord: 145.7ms (327 queries, 130 cached) | GC: 119.8ms)

Actions #3

Updated by Go MAEDA 5 days ago

  • Target version set to 6.1.0

Setting the target version to 6.1.0.

Actions #4

Updated by Go MAEDA 3 days ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch in r23750.

Actions

Also available in: Atom PDF