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

Assertions are slow when running on Windows with a debugger attached #481

Closed
pgroke opened this issue Mar 13, 2021 · 3 comments
Closed

Assertions are slow when running on Windows with a debugger attached #481

pgroke opened this issue Mar 13, 2021 · 3 comments

Comments

@pgroke
Copy link
Contributor

pgroke commented Mar 13, 2021

Description

Assertions are slow when running on Windows with a debugger attached.

The reason is the unconditional call of OutputDebugStringA which takes a comparatively very long time when a debugger is attached.

In my case the difference in execution time was dramatic. E.g. one test took over a minute when started from the IDE (with the debugger attached), while it takes less than a second when running without a debugger (same Debug build).

Also, in Visual Studio, the frequent calls of OutputDebugStringA with an empty string seem to overflow some buffer every now and then - Visual Studio periodically prints *** Output truncated by debugger *** in the debug window.

When I added a check so that OutputDebugStringA is only called when there's actually something to print, the execution time went down to about the time when running without a debugger (< 1 second in my case) -- and the *** Output truncated by debugger *** messages are gone too.

I've prepared a pull request.

Steps to reproduce

  • Write a simple test that does a lot of assertions (100k+) in otherwise trivial & fast code.
  • Compile for Windows with Visual Studio, Debug configuration
  • Start outside of Visual Studio without any debugger attached
  • Start from inside Visual Studio with debugger attached

Extra information

  • doctest version: v2.4.3
  • Operating System: Windows 10 x64 1909
  • Compiler+version: Visual Studio 2019 16.8.6
  • Configuration: x64-Debug
@pgroke
Copy link
Contributor Author

pgroke commented Mar 13, 2021

The windows-2016-gcc and windows-2019-gcc tests fail because the package http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-expat-2.2.9-1-any.pkg.tar.xz is no longer available. Unfortunately I have no idea where those tests are defined, so I also don't know how (where) to fix it.

@onqtam
Copy link
Member

onqtam commented Mar 21, 2021

I'm closing this as it has already been fixed (again thanks for reporting) - will release an official version soon!

@onqtam onqtam closed this as completed Mar 21, 2021
@pgroke
Copy link
Contributor Author

pgroke commented Mar 21, 2021

Sure! Thanks for the library :)

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

No branches or pull requests

2 participants