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

Unbuffered output of console reporter ingredient causes noticeable slowdown on Windows #101

Closed
sergv opened this issue Feb 25, 2015 · 3 comments · Fixed by #108
Closed

Comments

@sergv
Copy link
Contributor

sergv commented Feb 25, 2015

The ConsoleReporter ingredient uses NoBuffering mode when outputting test results. While it works fine on Linux, there's is noticeable slowdown when printing results of test run on Windows in cmd.exe, it's derivatives like msys and cygwin consoles. The visual effect is that output is being produced character-by-character and tests that took about 10 seconds with test-framework now take 30+ seconds to complete.

The problem is reproducible on both Windows XP and Windows 7 versions with 2014 Haskell Platform, and on a variety of terminal emulators.

The offending code is from core/Test/Tasty/Ingredients/ConsoleReporter.hs:

-- | A simple console UI
consoleTestReporter :: Ingredient
consoleTestReporter =
...
  (\k -> if isTerm
    then (do hideCursor; k) `finally` showCursor
    else k) $ do

      hSetBuffering stdout NoBuffering

So, is there a reason to use no buffering instead of line buffering?

@UnkindPartition
Copy link
Owner

Yes, the reason is so that the user sees which test is currently running. Otherwise, the test's name wouldn't appear until it's complete, which may be annoying for long-running tests.

I wonder if keeping the output buffered and calling hFlush explicitly would fix the problem. Can you try that?

@sergv
Copy link
Contributor Author

sergv commented Feb 25, 2015

Sure, I'll try it out.

@sergv
Copy link
Contributor Author

sergv commented Apr 2, 2015

Hi, sorry for long delay for such a trivial thing, but I finally managed to try it out and can confirm that adding hFlush maintains desired behavior when using line buffering on Windows.

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 a pull request may close this issue.

2 participants