Skip to content
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

[Core] Flush pretty output manually #2573

Merged
merged 1 commit into from
Jun 21, 2022
Merged

[Core] Flush pretty output manually #2573

merged 1 commit into from
Jun 21, 2022

Conversation

mpkorstanje
Copy link
Contributor

🤔 What's changed?

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

🏷️ What kind of change is this?

  • 🐛 Bug fix (non-breaking change which fixes a defect)

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

@mpkorstanje mpkorstanje force-pushed the 2563-flush-manually branch 2 times, most recently from 78a6fd1 to 27e7a0f Compare June 21, 2022 23:28
@codecov
Copy link

codecov bot commented Jun 21, 2022

Codecov Report

Merging #2573 (2eef85d) into main (0ee15f0) will increase coverage by 0.13%.
The diff coverage is 92.30%.

@@             Coverage Diff              @@
##               main    #2573      +/-   ##
============================================
+ Coverage     84.58%   84.72%   +0.13%     
+ Complexity     2664     2655       -9     
============================================
  Files           310      310              
  Lines          9357     9317      -40     
  Branches        901      899       -2     
============================================
- Hits           7915     7894      -21     
+ Misses         1111     1094      -17     
+ Partials        331      329       -2     
Impacted Files Coverage Δ
...main/java/io/cucumber/core/plugin/AnsiEscapes.java 95.65% <ø> (+7.65%) ⬆️
...java/io/cucumber/core/plugin/MessageFormatter.java 84.61% <ø> (-1.10%) ⬇️
.../java/io/cucumber/core/plugin/PrettyFormatter.java 85.23% <83.33%> (-0.29%) ⬇️
...ava/io/cucumber/core/plugin/ProgressFormatter.java 90.24% <100.00%> (+0.24%) ⬆️
...n/java/io/cucumber/core/plugin/RerunFormatter.java 100.00% <100.00%> (ø)
.../java/io/cucumber/core/plugin/UTF8PrintWriter.java 100.00% <100.00%> (ø)
...ucumber/core/plugin/UnusedStepsSummaryPrinter.java 86.66% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0ee15f0...2eef85d. Read the comment docs.

@mpkorstanje mpkorstanje marked this pull request as ready for review June 21, 2022 23:32
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
@mpkorstanje mpkorstanje merged commit dc7a7d6 into main Jun 21, 2022
@mpkorstanje mpkorstanje deleted the 2563-flush-manually branch June 21, 2022 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default scenario logging does not show up in step notifications
1 participant