| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
The sampling profiler code had numerous imports placed inside functions rather than at module level. While deferred imports can reduce startup time for rarely-used code paths, these imports were in functions called during normal profiler operation, adding repeated import overhead. Moving imports to module level follows Python best practices for code that runs frequently. This makes import dependencies explicit at file scope and eliminates per-call import lookup costs. The test files also had redundant local imports that duplicated module-level imports.
Keep curses import as a local import in sample_live() since curses is not available on Windows. The original code had this as a local import to avoid breaking Windows tests that import the module.
| Back | FazBrowse Home | New Git URL |
The sampling profiler code had numerous imports placed inside functions
rather than at module level. While deferred imports can reduce startup
time for rarely-used code paths, these imports were in functions called
during normal profiler operation, adding repeated import overhead.
Moving imports to module level follows Python best practices for code
that runs frequently. This makes import dependencies explicit at file
scope and eliminates per-call import lookup costs. The test files also
had redundant local imports that duplicated module-level imports.