Project

General

Profile

Actions

Feature #43957

closed

Improve workflow update performance

Added by Go MAEDA 23 days ago. Updated 15 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Performance
Target version:
Resolution:
Fixed

Description

When the number of issue statuses grows, updating workflows becomes significantly slower.

The current implementation of WorkflowTransition.replace_transitions loads matching workflow transition records into an array, and then repeatedly searches that array with select method inside nested loops over statuses, rules, trackers, and roles. As the number of statuses increases, this repeated full-array scanning becomes expensive and makes workflow updates noticeably slow.

This patch improves the performance by changing the transition lookup from repeated scans over a large array to hash-based lookup. Existing records are grouped by transition scope first, and later lookups use the grouped hash instead of performing full-array filtering every time. This keeps the change relatively small while reducing the Ruby-side lookup cost substantially.

On my development environment, I measured the following results for WorkflowTransition.replace_transitions:

statuses Average time before (sec) Average time after (sec) speedup
10 0.0773 0.0566 1.37x
20 0.3747 0.1660 2.26x
40 3.8072 0.6849 5.56x
80 60.7722 2.8387 21.41x

Files

Actions #1

Updated by Go MAEDA 21 days ago

  • Target version set to Candidate for next major release
Actions #2

Updated by Go MAEDA 17 days ago

  • Target version changed from Candidate for next major release to 7.0.0

Setting the target version to 7.0.0.

Actions #3

Updated by Go MAEDA 17 days ago

This is the benchmark script. After applying the patch, run:

bin/rake db:fixtures:load RAILS_ENV=test
bin/rails runner -e test 43957-bench.rb
Actions #4

Updated by Go MAEDA 15 days ago

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

Committed the patches in r24598 and r24599.

Actions

Also available in: Atom PDF