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
Fix parsing @args.rsp compiler arguments #25205
Conversation
Looks good to me (though bash is not an ideal language for writing parsers...). It should be applied to the staging branch though. |
Changed target branch to staging. I though of writing in another language, but it seemed to be difficult to integrate with |
Looks good for me, too; I can only guess what performance would be, but probably better on average than forking a compiled parser. |
IMHO performance is acceptable (faster than a subsequent compiler, and .rsp files are rarely used), although a compiled parser would beat it: you can perform a realistic test with
On my machine this 1KB file is parsed in 0.13 seconds. |
On my machine this 1KB file is parsed in 0.13 seconds.
Ah well, that may be beatable with `eval "$(./parser test.rsp)"` but not worth the effort.
|
This seems to be affecting linking times of Haskell projects (which are being linked with gcc and as I understand always linked using response files - https://ghc.haskell.org/trac/ghc/ticket/8596). On a project that otherwise builds in under one minute (not including dependencies) this change adds over a minute of overhead. Would it be worth filing an issue, or would that kind of overhead not be considered substantial enough? Happy to provide an .rsp file I extracted during the build (36KB, ~ 500 lines). |
Could you upload an .rsp on https://gist.github.com/ ? |
@orivej thanks, uploaded a file to https://gist.github.com/pbogdan/9d6986bf931b58a70d75e14eb40ee8a1 @corngood will run those shortly |
|
This patch reduces parse time to 12 seconds. I'm going to see if it can be improved even further: local s="$1"
local state=0
local arg=''
+ local len="${#s}"
- for (( i=0; i<${#s}; i++ )); do
+ for (( i=0; i<$len; i++ )); do
local c="${s:$i:1}"
local cls=1
case "$c" in |
#26554 parses your example in one second. |
Improves upon NixOS#25205 https://gist.github.com/pbogdan/9d6986bf931b58a70d75e14eb40ee8a1 parsing time is reduced from one minute to one second
I tried to build a copy of
llvm
with-DBUILD_SHARED_LIBS=ON -DLLVM_BUILD_LLVM_DYLIB=OFF
but the build failed becausenix
incorrectly expanded .rsp file contents:-Wl,-rpath,"\$ORIGIN/../lib"
in a .rsp becomes-Wl,-rpath,\/../lib
in the arguments.This patch introduces a parser that follows gcc documentation:
Related: #11762