<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/import-profiling-and-pth--hkp8ptmtb" -->

---
title: import profiling and .pth! | daily.dev
description: Imports and slow code in .pth files do not show up as modules in import profiles, but slow .pth execution does appear under the `site` module. The presenter...
canonical: https://daily.dev/posts/import-profiling-and-pth--hkp8ptmtb
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: import profiling and .pth! | daily.dev
og:description: Imports and slow code in .pth files do not show up as modules in import profiles, but slow .pth execution does appear under the `site` module. The presenter...
og:url: https://daily.dev/posts/import-profiling-and-pth--hkp8ptmtb
og:image: https://api.daily.dev/og/posts/HKp8pTMTb.png
og:image:alt: import profiling and .pth!
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# import profiling and .pth!

**[anthonywritescode](https://daily.dev/sources/anthonywritescode)** · 6 min read · 0 upvotes · 0 comments

## Summary

Imports and slow code in .pth files do not show up as modules in import profiles, but slow .pth execution does appear under the `site` module. The presenter uses his import-time-waterfall tool, which builds on Python's built-in import time data, and a test `import asyncio` line made the run slower. By default the tool ignores interpreter startup, so that import is missing from the graph until you pass the include-interpreter-startup option. Slow code in a .pth file shows up as a gray bar under `site`, because .pth files are not modules and their loading code lives in `site` itself.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=c4LfBjz02dM>

## Similar posts on daily.dev

- [Python: introducing profiling-explorer](https://daily.dev/posts/python-introducing-profiling-explorer-eb3yvhchy) · Adam Johnson · 1 upvotes · 0 comments
- [Explicit Lazy Imports Are Coming to Python 3.15](https://daily.dev/posts/explicit-lazy-imports-are-coming-to-python-3-15-e4cphmy32) · JetBrains · 0 upvotes · 0 comments
- [Why Is My Code So Slow? A Guide to Py-Spy Python Profiling](https://daily.dev/posts/why-is-my-code-so-slow-a-guide-to-py-spy-python-profiling-oiuqa99od) · Towards Data Science · 0 upvotes · 0 comments
- [Python 3.15 Preview: Lazy Imports – Real Python](https://daily.dev/posts/python-3-15-preview-lazy-imports-real-python-dsgagrmmp) · Real Python · 0 upvotes · 0 comments
- [CPython doesn’t execute your .py file directly](https://daily.dev/posts/cpython-doesn-t-execute-your-py-file-directly-iodqx5ugs) · Medium · 0 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python)

[View this post on daily.dev](https://daily.dev/posts/import-profiling-and-pth--hkp8ptmtb)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"import profiling and .pth!","url":"https://daily.dev/posts/import-profiling-and-pth--hkp8ptmtb","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/import-profiling-and-pth--hkp8ptmtb"},"datePublished":"2026-12-02T18:19:00.444Z","dateModified":"2026-12-02T18:19:15.524Z","description":"Imports and slow code in .pth files do not show up as modules in import profiles, but slow .pth execution does appear under the `site` module. The presenter...","image":"https://i.ytimg.com/vi/c4LfBjz02dM/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/c4LfBjz02dM/sddefault.jpg","isAccessibleForFree":true,"articleSection":"anthonywritescode","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"anthonywritescode","logo":"https://media.daily.dev/image/upload/s--i0iRibbN--/f_auto,q_auto/v1777800760/logos/anthonywritescode?_a=BAMAMiWQ0","url":"https://daily.dev/sources/anthonywritescode"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/import-profiling-and-pth--hkp8ptmtb","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python","timeRequired":"PT6M","video":{"@type":"VideoObject","name":"import profiling and .pth!","description":"Imports and slow code in .pth files do not show up as modules in import profiles, but slow .pth execution does appear under the `site` module. The presenter...","thumbnailUrl":"https://i.ytimg.com/vi/c4LfBjz02dM/sddefault.jpg","uploadDate":"2026-12-02T18:19:00.444Z","duration":"PT6M","url":"https://api.daily.dev/r/HKp8pTMTb","embedUrl":"https://www.youtube.com/embed/c4LfBjz02dM"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"anthonywritescode","item":"https://daily.dev/sources/anthonywritescode"},{"@type":"ListItem","position":3,"name":"import profiling and .pth!"}]}
```

