ash-project / ash-project/igniter

Performance Investigation: Speed Issues in `copy_template` Function

Open
#187 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Elixir
Stars
404
Forks
75
Avg merge
9h 58m
Merged PRs (30d)
3

Description

As we discussed on Discord, I’ve been looking into the speed issues with the `copy_template` function and have come across some of the following findings.

It’s worth mentioning, based on the timings I shared on Discord, that the slowdown isn’t caused by a single function in this process. Instead, there are several operations in different parts that individually take around 60 to 70 milliseconds.

> The Igniter library takes around 200 to 400 milliseconds for a single file, which is great, especially if the script isn’t of a continuous type.

> This issue mainly arises for use cases like mine, where it takes about 80 to 350–400 milliseconds per file, resulting in a total time > of around 32 seconds on a system with 16 GB of RAM and a 7700K CPU.

### Tracking

1. `Igniter.create_new_file`: `{11, 56813, 0, 182955}`
2. As you see in this function we have 2 big number `56813` and `182955`
3. The second one is for `maybe_format` function
4. Inside the `format` function you have these numbers `{2876, 68006, 2662, 0, 108013, 1}`
5. After that inside this function `with_evaled_configs` you have `68002`

All the function in this junction, each of them has 2 or 3 big number approximately!

Thank you in advance

### Ref
1. https://discord.com/channels/711271361523351632/1253324141491261472/1325842217088192532

Contributor guide

Open the contributing guide

Research direction

Start by tracing the `copy_template` flow through `Igniter.create_new_file`, `maybe_format`, `format`, and `with_evaled_configs`, using the timings and Discord reference in the issue as context. Reproduce the reported per-file slowdown and profile those entry points; done means the bottleneck is identified and the performance impact is measured against the reported timings.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
performance, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.