-
-
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
Pretty print plugin performance issues #2481
Comments
Very interesting. I'll have to take a good look. |
When a plugin doesn't write to a file, it defaults to standard out. For this the
The first is important important for the progress formatter which only outputs dots. Not flushing immediately would hide the progress indication in the buffer. The second is important for the pretty formatter. It doesn't need a flush after every append, but the information for each step should be flushed. However the pretty formatter doesn't need to flush every append and I would expect that the underlying print stream already flushes on new lines. The third is important for the rerun and unused steps formatters. However neither cares about timely output. So after confirming that the |
|
Pull request submitted. Thanks for the help! |
I submitted separate pull requests. You can choose either one or both.
|
For the sake of efficiency and performance we write to buffered writers. However, the pretty plugin is expected to print scenarios as they're started and steps as they're finished. This was initially resolved by flushing the `NiceAppendable` on every write. This turned out to have performance impact (#2481) and interact poorly with tools that expected (#2536) us to be better behaved. By having `NiceAppendable` flush only when the underlying buffer was full these problems were resolved (#2541) . However, because the underlying buffer is 8KiB the pretty formatters output would effectively sit in a buffer until the writer was closed. So now we flush the pretty and progress output manually after each event. This strikes a balance somewhere between the flush-everything-all-the-time and flush-when-full approaches. Fixes: #2563
For the sake of efficiency and performance we write to buffered writers. However, the pretty plugin is expected to print scenarios as they're started and steps as they're finished. This was initially resolved by flushing the `NiceAppendable` on every write. This turned out to have performance impact (#2481) and interact poorly with tools that expected (#2536) us to be better behaved. By having `NiceAppendable` flush only when the underlying buffer was full these problems were resolved (#2541) . However, because the underlying buffer is 8KiB the pretty formatters output would effectively sit in a buffer until the writer was closed. So now we flush the pretty and progress output manually after each event. This strikes a balance somewhere between the flush-everything-all-the-time and flush-when-full approaches. Fixes: #2563
For the sake of efficiency and performance we write to buffered writers. However, the pretty plugin is expected to print scenarios as they're started and steps as they're finished. This was initially resolved by flushing the `NiceAppendable` on every write. This turned out to have performance impact (#2481) and interact poorly with tools that expected (#2536) us to be better behaved. By having `NiceAppendable` flush only when the underlying buffer was full these problems were resolved (#2541) . However, because the underlying buffer is 8KiB the pretty formatters output would effectively sit in a buffer until the writer was closed. So now we flush the pretty and progress output manually after each event. This strikes a balance somewhere between the flush-everything-all-the-time and flush-when-full approaches. Fixes: #2563
For the sake of efficiency and performance we write to buffered writers. However, the pretty plugin is expected to print scenarios as they're started and steps as they're finished. This was initially resolved by flushing the `NiceAppendable` on every write. This turned out to have performance impact (#2481) and interact poorly with tools that expected (#2536) us to be better behaved. By having `NiceAppendable` flush only when the underlying buffer was full these problems were resolved (#2541) . However, because the underlying buffer is 8KiB the pretty formatters output would effectively sit in a buffer until the writer was closed. So now we flush the pretty and progress output manually after each event. This strikes a balance somewhere between the flush-everything-all-the-time and flush-when-full approaches. Fixes: #2563
For the sake of efficiency and performance we write to buffered writers. However, the pretty plugin is expected to print scenarios as they're started and steps as they're finished. This was initially resolved by flushing the `NiceAppendable` on every write. This turned out to have performance impact (#2481) and interact poorly with tools that expected (#2536) us to be better behaved. By having `NiceAppendable` flush only when the underlying buffer was full these problems were resolved (#2541) . However, because the underlying buffer is 8KiB the pretty formatters output would effectively sit in a buffer until the writer was closed. So now we flush the pretty and progress output manually after each event. This strikes a balance somewhere between the flush-everything-all-the-time and flush-when-full approaches. Fixes: #2563
For the sake of efficiency and performance we write to buffered writers. However, the pretty plugin is expected to print scenarios as they're started and steps as they're finished. This was initially resolved by flushing the `NiceAppendable` on every write. This turned out to have performance impact (#2481) and interact poorly with tools that expected (#2536) us to be better behaved. By having `NiceAppendable` flush only when the underlying buffer was full these problems were resolved (#2541) . However, because the underlying buffer is 8KiB the pretty formatters output would effectively sit in a buffer until the writer was closed. So now we flush the pretty and progress output manually after each event. This strikes a balance somewhere between the flush-everything-all-the-time and flush-when-full approaches. Fixes: #2563
Pretty print plugin is slow, because:
Combination of previous points results in poor performance. In my situation the plugin doubles the run time.
Single thread
When running Cucumber tests in a single thread, the bottleneck is in the
OutputStreamWriter.flush()
method.Multi-threading
When running Cucumber tests in multiple threads, the bottleneck is still in the
flush()
method. Because printing is called from synchronisedSynchronizedEventBus.send()
method, a thread has to wait forflush()
in other threads, which subsequently kills performance gains from multi-threaded solution.Expected behaviour
Performance of the
NiceAppendable
class should be improved to be close to running tests without the plugin. A good idea may be not to flush on every line.io.cucumber:cucumber-java:7.2.3
The text was updated successfully, but these errors were encountered: