# Reducing TTFX of a macro-focused package (\`DataPipes\`)

**URL:** <https://discourse.julialang.org/t/reducing-ttfx-of-a-macro-focused-package-datapipes/99776>\
**Category:** General Usage\
**Created:** [June 2, 2023, 4:15pm UTC](https://discourse.julialang.org/t/reducing-ttfx-of-a-macro-focused-package-datapipes/99776 "2023-06-02T16:15:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aplavin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aplavin/32/222056_2.png) [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Post date:** [June 2, 2023, 4:15pm UTC](https://discourse.julialang.org/t/reducing-ttfx-of-a-macro-focused-package-datapipes/99776/1 "2023-06-02T16:15:25Z")

</div>

I’m trying to evaluate precompilation benefits for my packages, and understand what to run during precompilation for best results in different situations.

This question is about macro-focused packages, taking [DataPipes](https://discourse.julialang.org/t/ann-datapipes-jl-0-3-0/60734) as an example. Without any precompilation directives, timings are:

```julia
precompile: <1 sec
`using DataPipes`: 0.012200 seconds (8.16 k allocations: 578.810 KiB)
`@eval @p 123`: 2.206762 seconds (2.77 M allocations: 172.314 MiB, 7.64% gc time, 99.89% compilation time)

```

> **Command to run**
>
> ```julia
> julia --startup=no --project -e 'using Pkg; Pkg.precompile(); using InteractiveUtils; @showtime using DataPipes; @showtime @eval @p 123'
> 
> ```

After adding a short statement run during precompilation ([this line](https://gitlab.com/aplavin/DataPipes.jl/-/blob/master/src/DataPipes.jl#L58)), I get:

```julia
precompile: 9 sec
`using DataPipes`: 0.306198 seconds (520.01 k allocations: 23.272 MiB, 29.38% gc time)
`@eval @p 123`: 0.266229 seconds (326.42 k allocations: 21.089 MiB, 99.29% compilation time)

```

Does that look like the correct way to precompile macro packages, are there any specifics?

Is the 30x loading time increase expected? And 10x precompilation time?

What can be done to reduce TTFX even further? It’s reasonably fast already, but wonder if more improvements are possible through precompilation.
