# Capturing "sub" dependencies during precompilation

**URL:** <https://discourse.julialang.org/t/capturing-sub-dependencies-during-precompilation/123013>\
**Category:** Performance\
**Tags:** precompilation\
**Created:** [November 24, 2024, 10:46am UTC](https://discourse.julialang.org/t/capturing-sub-dependencies-during-precompilation/123013 "2024-11-24T10:46:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sstroemer](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@sstroemer](https://discourse.julialang.org/u/sstroemer)\
**Post date:** [November 24, 2024, 10:46am UTC](https://discourse.julialang.org/t/capturing-sub-dependencies-during-precompilation/123013/1 "2024-11-24T10:46:50Z")

</div>

I have a package `X` which depends on `Y` which depends on `Z`. `Z` is not a direct dependency of `X`, and `Y` is done by a “third-party”, so I can’t influence it.

I’m using some example code `@compile_workload`, but still see a lot of compile statements when running the same code after loading `X` during usage. I’ve managed to “fake compile” these calls by observing them with `--trace-compile` and then doing

```julia
Z = Y.Z

precompile(...)

```

where `precompile(...)` is some captured compilation statement that involves `Z`. This seems to improve TTFX for me by quite some bit, but it feels hacky. What would be the correct way to approach this?
