Debugger warnings kill import performance
Split from https://github.com/Microsoft/PTVS/issues/3408

I also get a ton of messages on the output screen before the program loads that weren't there before in PTVS:

"Standard library module invoked user code during import; breakpoints disabled for invoked code."


If you use the classifier cookiecutter project and start debuging with a breakpoint on the read_table line (which means it imports pandas, numpy and matplotlib):

- It takes over 120-150 secs to reach breakpoint with 1000s of warning in output window
- It takes 5-10 secs if the warning is removed


diff --git a/Python/Product/PythonTools/ptvsd/debugger.py b/Python/Product/PythonTools/ptvsd/debugger.py
index e28a449aa..4244cf058 100644
--- a/Python/Product/PythonTools/ptvsd/debugger.py
+++ b/Python/Product/PythonTools/ptvsd/debugger.py
@@ -776,6 +776,7 @@ class Thread(object):
         self.django_stepping = None
         self.is_sending = False
         self.is_importing_stdlib = False
+        self.is_importing_stdlib_warned = False
 
         # stackless changes
         if stackless is not None:
@@ -938,7 +939,8 @@ class Thread(object):
         # If we're importing stdlib, don't trace nested calls until we return from the import that started it,
         # but notify the user if these nested calls end up in non-stdlib code.
         if self.is_importing_stdlib:
-            if not is_stdlib(path.normcase(co_filename)):
+            if not self.is_importing_stdlib_warned and not co_filename.startswith('<') and should_debug_code(f_code):
+                self.is_importing_stdlib_warned = True
                 debug_output.write('Standard library module invoked user code during import; breakpoints disabled for invoked code.\\n')
             return self.prev_trace_func
 
['Python/Product/PythonTools/ptvsd/debugger.py']