# How to benefit from package specific @recompile\_invalidations when developing the same package?

**URL:** <https://discourse.julialang.org/t/how-to-benefit-from-package-specific-recompile-invalidations-when-developing-the-same-package/120805>\
**Category:** General Usage\
**Tags:** question, precompilation, method-invalidation, precompiletools\
**Created:** [October 2, 2024, 8:58am UTC](https://discourse.julialang.org/t/how-to-benefit-from-package-specific-recompile-invalidations-when-developing-the-same-package/120805 "2024-10-02T08:58:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![frankier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frankier/32/35101_2.png) [@frankier](https://discourse.julialang.org/u/frankier)\
**Post date:** [October 2, 2024, 8:58am UTC](https://discourse.julialang.org/t/how-to-benefit-from-package-specific-recompile-invalidations-when-developing-the-same-package/120805/1 "2024-10-02T08:58:11Z")

</div>

I have a package `MyPackage` that loads stuff in an order that ends up invalidating a lot of Makie.

```julia
using DependencyA
using Makie

```

Long term I would like to solve it, but for now I would just like to work around it. If I use PrecompileTools.@recompile\_invalidations when my package’s requirements then things work quite well.

```julia
using DependencyA
using Makie

```

The recompilations take about 2 minutes, but save me at least 30 seconds for my plot to draw.

However, now whenever I modify my package, I it looks like the invalidations get recompiled (when not using Revise). I guess this is because precompilation works at the pkgimage level. (Perhaps?)

So is the only solution to isolating the invalidation recompilation from changes in `MyPackage` creating a new package just for this? Or is there some other way to isolate it from my changes in MyPackage?

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [October 2, 2024, 9:08am UTC](https://discourse.julialang.org/t/how-to-benefit-from-package-specific-recompile-invalidations-when-developing-the-same-package/120805/2 "2024-10-02T09:08:48Z")

</div>

> [@frankier](#):
>
> So is the only solution to isolating the invalidation recompilation from changes in `MyPackage` creating a new package just for this? Or is there some other way to isolate it from my changes in MyPackage?

I think you have to create a new package.

---

<div class="post-metadata">

**Author:** ![frankier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frankier/32/35101_2.png) [@frankier](https://discourse.julialang.org/u/frankier)\
**Post date:** [October 11, 2024, 1:05pm UTC](https://discourse.julialang.org/t/how-to-benefit-from-package-specific-recompile-invalidations-when-developing-the-same-package/120805/3 "2024-10-11T13:05:15Z")

</div>

That definitely seems to be the case. I suppose what I’m thinking is that it would be a lot more useful in case it were possible to have a private package dependency in which to put all the extra precompiles. As it is, long term this would require registering another package, although I suppose I can still speed up development by `dev`ing a dummy package locally and not commiting anything to do with that.

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [October 27, 2024, 11:41am UTC](https://discourse.julialang.org/t/how-to-benefit-from-package-specific-recompile-invalidations-when-developing-the-same-package/120805/4 "2024-10-27T11:41:08Z")

</div>

This section in the PrecompileTools.jl docs seems relevant: [Package developers: reducing the cost of precompilation during development](https://julialang.github.io/PrecompileTools.jl/stable/#Package-developers:-reducing-the-cost-of-precompilation-during-development)
