-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
👓 What did you see?
We execute cucumber scenarios with a high number of threads (> 150). We had massive problems with the tests starting slowly and needing a lot of initial CPU. Profiling the code I found the main bottleneck to be the creation of expressions in io.cucumber.cucumberexpressions.ExpressionFactory#createExpression which is called (via some other methods) by io.cucumber.core.runner.CachingGlue#prepareGlue.
For every thread all glue code classes are parsed and step definitions are created
✅ What did you expect to see?
As the glue code is the same for all scenarios I'd expect it to be parsed once beforehand. I wrote a custom implementation with copies of some of the involved classes which (very hackily) saves the created step definitions of ExpressionFactory in a static map. This reduces the startup time of the tests on our pipeline drastically.
📦 Which version are you using?
7.0.0
🔬 How could we reproduce it?
Start 150 scenarios or more in parallel. Or just two - the basic problem is always there, it's just more apparent with more threads.
🤔 Anything else?
We have more than 5000 step definitions using method annotations and use a lot of custom parameter types which makes parsing them quite heavy.