-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
makepkg: lint_pkgbuild
is slow
#19
Comments
I always disable linting because of this recently... Yeah, might be a good idea to make it opt in. |
Excluding the msys2 dir from defender also helps a lot |
I've created #18 Feedback welcome |
@lazka, thanks for the efforts. Another question goes about the actual parsing implementation. @MehdiChinoune commented yesterday:
As the original issue is already closed, I quote and comment it here: @lazka commented on Jul 31, 2021 in msys2/MINGW-packages#2593:
I struggle at analyzing all the related Bash code at the moment. Could you please summarize:
|
because it's fast on Linux, and pacman is primarily developed for Linux.
Tricky since PKGBUILD files are written in bash. Someone would have to speed things up without complicating the code too much, and propose that to upstream. I see some potential by evaluating functions once and then re-using that for further checks, but that's no small change. |
Thanks. And I am yet to see the forking source (no pun intended:) IOW I believe that
I guess I will need to dedicate some days into diving into the set of related Bash scripts anyways. |
You can run just as an example, the following contains some parts of the code involved: #!/bin/bash
for i in {1..1000}
do
while read -r; do
true
done < <(echo "")
done This takes:
|
Thanks. I added some traces to the scripts and found this little guy called Here it runs
... which in turn does some parsing by executing
@lazka, do you know (why) is using subshell absolutely needed here? |
makepkg
preparation step before Making package: mingw-w64-clang ...
is slowlint_pkgbuild
is slow
Thanks for fixing the title (you beat me to it:) Maybe it's worth reporting to the upstream? |
OK, it seems my thought was wrong. I tried to move the
This (unexpectedly) increased running time by the 18%, it's 110s => 130s! Before the change:
After the change:
I guess, the |
OK, I tried to use Bash ERE matching instead. The inspiration: For that I used operator The ASCII diff
This alone gave me ~30% or ~30s decrease (96 => 67) in running time of The potential issue with the PoC at the moment is that it doesn't handle the next matching lines of the same function. Though this could be worked around by multiplying Not sure if my PoC is worth of extending. The running time is still quite long: ~1m7s on my machine. |
Description
I tried building newest msys2/MINGW-packages/mingw-w64-clang.
Every time I run
makepkg-mingw
, things afterBuilding mingw64...
and beforeMaking package: mingw-w64-clang 14.0.6-6
take ~90-120 seconds to complete:My machine has i5-6200U CPU running @ 2.30GHz:
Is this expected? And why?
Verification
Windows Version
Microsoft Windows [Version 10.0.19044.1889]
MINGW environments affected
Expected behavior
Tried tracing the scripts using
set -x
. Looks like it's doing a lot of Bash processing. Big part of which seems to be repetitive.Eg. I noticed the Bash function
lint_pkgbuild()
coming from pacman/scripts/libmakepkg and occurring at the start of my trace.I expect to know the root cause of this step taking so relatively long to complete.
And whether is this expected.
Actual behavior
The initial step takes ~90-120 seconds to complete.
Repro steps
1. Download the files:
2. Go into the Clang dir:
3. Start
makepkg
& stop it just before the build:The text was updated successfully, but these errors were encountered: