www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Start-up speed overhead of `dub run dscanner`

reply Anonymouse <zorael gmail.com> writes:
I want to call dscanner 73 times in succession, because I can't 
pass it a source directory to recursively scan without it failing 
an assert parsing one of the files. ([dscanner 
https://github.com/dlang-community/D-Scanner/issues/931))

I want to do it in a CI build/test script, so I thought I'd just 
make it `dub run dscanner -- -S --skipTests [...]` and avoid 
having to clone the dscanner repo and build it manually, but it's 
slow. It's slow even if I add `--nodeps` after the first build. 
On my local machine I can install dscanner from repositories, 
which is as fast as I expect it to be, but on CI I'm a bit more 
limited.

Simplified:

```
$ time ( for f in source/**/*.d; do dub run dscanner --nodeps 
--vquiet -- -S --skipTests $f; done )
7,87s  user 3,33s system 99% cpu 11,304 total

$ time ( for f in source/**/*.d; do /usr/bin/dscanner -S 
--skipTests $f; done )
1,28s  user 0,45s system 100% cpu 1,725 total
```

I *can* clone the dscanner repo and build it myself. I can think 
of plenty of workarounds. I can even delete or rename the 
offending file causing the assert before scanning.

But is there anything non-invasive I can do that lets me keep 
`dub run`? I don't see a way to query dub for the path to the 
already-built executable. There is a `--force` flag to make it 
always rebuild, but no inverse 
`--trust-me-its-okay-just-run-the-thing` flag.
Jan 27
parent Mathias Lang <geod24 gmail.com> writes:
On Monday, 27 January 2025 at 17:04:39 UTC, Anonymouse wrote:
 Simplified:

 ```
 $ time ( for f in source/**/*.d; do dub run dscanner --nodeps 
 --vquiet -- -S --skipTests $f; done )
 7,87s  user 3,33s system 99% cpu 11,304 total

 $ time ( for f in source/**/*.d; do /usr/bin/dscanner -S 
 --skipTests $f; done )
 1,28s  user 0,45s system 100% cpu 1,725 total
 ```
Could you create an issue in dub with the `-v` output of one invocation to see where it's spending time ?
Jan 27