Skip to content

Upgrading from 11.0.0 to 11.1.1 causes a big increase in time for message creation #1902

Description

@rickpastoor

👓 What did you see?

My tests consist of 1584 scenarios and 18147 steps. On 11.0.0 this takes roughly 3 mins. Since the bump, it takes at least 4.5mins.

AI did a bit of digging and profiling, and it pinned it down to the following change in the MessageBuilder. I've included it, it might be a helpful pointer but obvious you folks know best what the reason for that change was.


Cucumber 11.1.x rewrote Formatter::MessageBuilder#on_test_step_started / #on_test_step_finished. What was an O(1) hash lookup:

test_case = @test_case_by_step_id[event.test_step.id]

became a full scan of every test case accumulated so far, checking every step of each:

@repository.test_case_by_id.values
           .detect { |tc| tc.test_steps.any? { |s| s.id == event.test_step.id } }

That runs twice per step, and the repository grows as the run progresses, so the cost is quadratic in suite size.

✅ What did you expect to see?

Upgrading should not impact the test run in such a big way.

📦 Which tool/library version are you using?

No response

🔬 How could we reproduce it?

No response

📚 Any additional context?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions