You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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
Extra information
The text was updated successfully, but these errors were encountered: