-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Faster caching glue #2902
base: main
Are you sure you want to change the base?
Faster caching glue #2902
Conversation
That would be great! ( |
I think the glue could also be reused if:
I pushed the branch I have a Cucumber plugin which gets a lot of StepDefined events: I need to remove the duplicates, so it would not be an issue when the duplicate events are not emitted. When changing this test-case to await only 2 StepDefined events instead of 4, the build passes and on my usual test project (~600 test scenarios, 230 step definitions), I get incredible results:
More or less twice faster... 😁 |
Unfortunately, what I don't like about my current solution is that it involves way too much code. It is too easy to mess it up and piles complexity on top of complexity. And most of that complexity is unnecessary in my opinion. If we only had to consider With And that makes for a really complicated cache key. Then to make matters worse, each time a step definition is defined Cucumber emits a message. This generates a lot (scenarios * step definitions) messages. These messages contain an identifier that is used to emit another a message when a step is executed. So we have more state being created when a scenario is executed, and that state should then be reused for others scenarios. And that possibly happens in parallel. So what I'm hoping to do is change the design of Cucumber so step definitions can be discovered at different times during the execution process. Each of these would be treated as a distinct set. This would then allow a cache key to be shaped like Then to ensure that lambda step definitions consistently re-create the same key, they'd have to be created without any state. Which means the reference to the lambda they invoke must be stored in some execution context that is bound to the scenario scope instead (something like JUnit 5). And then, once we can ensure the same step definitions is created each time, we can also ensure a message for each step definition is only emitted once. The the messages would be emitted when the cache entry is created. So I'm looking for an architecture where if done correctly, the solution to those problems just falls out of it. |
When your start caching data, this means that your are not following the Don't Repeat Yourself principle anymore. But of course sometimes you don't have the choice... Regarding the |
🤔 What's changed?
Work in progress. Parking this in a pull request so I won't forget about it.
Currently the
CachingGlue
is rather limited in what it can cache. Step definitions are derived from parameter types, and because these can beDisposable
, this means that we dispose of the whole cache after each scenario.But glue can be reused between scenarios if
⚡️ What's your motivation?
🏷️ What kind of change is this?
♻️ Anything particular you want feedback on?
📋 Checklist:
This text was originally generated from a template, then edited by hand. You can modify the template here.