You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P2][perf] the shipped git.exe launcher adds ~114ms per invocation: time git 202ms vs 32ms direct, Git Bash does 68ms #8
changed the title [-][P2][perf] the shipped git.exe launcher costs ~114ms per invocation - 6x the real binary; time git 202ms vs Git Bash 68ms[/-][+][P2][perf] the shipped git.exe launcher adds ~114ms per invocation: time git 202ms vs 32ms direct, Git Bash does 68ms[/+]on Oct 14, 2026
A hardlink costs nothing: 12.7 ms against the payload's 13.1 ms is noise. A forwarding wrapper costs a full process, 19.4 ms, which lands it in the same band as the Git for Windows cmd\git.exe launcher (38.7 ms in the same run).
The link is location-independent
A link placed in a different directory still self-locates, so patch #3's upward marker probe is not tied to usr\bin:
End-to-end in a real repository (3,942 entries, 30+ worktrees): status --porcelain, log -1, rev-parse --show-toplevel, and submodule status (which needs sh) all behave.
Caveat that belongs in this issue
A hardlink only helps if something refreshes it. On this machine the live inode is shared by .wpm/staging/niugit/mingw64/bin/git.exe, usr\bin\git.exe and bin\git.exe, while opt/niugit/mingw64/bin/git.exe is a second, separate 5.2 MB file, even though the wpm manifest declares opt/niugit/... as the payload. Any update that replaces one path by unlink-plus-create leaves the PATH-visible link serving the old bytes. Filed against WinuxCmd; the same refresh requirement applies to whatever mechanism this issue settles on.
Suggestion
Keep the entry point a hardlink to the real binary. If a launcher is needed for environment setup, resolve that in-process (argv[0] dispatch, as proposed for sh/bash) rather than by spawning a second executable.
Activity
[-][P2][perf] the shipped git.exe launcher costs ~114ms per invocation - 6x the real binary; time git 202ms vs Git Bash 68ms[/-][+][P2][perf] the shipped git.exe launcher adds ~114ms per invocation: time git 202ms vs 32ms direct, Git Bash does 68ms[/+]v2.55.0.5: static git + system_prefix self-locate (wpm flat layout) (#9)
niugit: 2.55.0.5 (static zlib/iconv, flat layout - bare usr/bin/git.e…
caomengxuan666 commentedon Oct 16, 2026
已修复并发布:v2.55.0.5(launcher 这一跳被彻底消掉)
修复方向 1 落地,而且不是「硬链接到 launcher」,是让真身直接站在 PATH 位上:
layout: flat:包的mingw64/bin/git.exe直接映射到<root>/usr/bin/git.exe(usr/bin/git.exe现在就是 5,203,968 字节的真 git 本体,不再是 4MB launcher,也没有 winuxcmd 分派跳);system_prefix自定位):剥离路径得到的前缀先用<prefix>/<GIT_EXEC_PATH>校验,不成立就向上探测 payload 标记(opt/niugit/mingw64、mingw64)→ 因此「裸二进制 + 非安装 cwd」也能找到 exec-path/templates/系统配置,不需要 launcher 帮它设环境。正常 MinGit/构建树布局仍走原路径(只多一次is_directory,字节级不变)。本票指标实测(同机,niu 内
time git)time git --version(niu 内)time git status --porcelain(niu 内,热)即 比目标还快约 3 倍,也优于 Git Bash。附带:
git.exe的导入表只剩系统 DLL(zlib/iconv 静态链接),libcurl/zlib/libexpat放在libexec/git-core(不在 PATH),所以这一跳消掉的同时 DLL 搜索路径也不再需要环境布设。本票列出的验证面(均在非安装 cwd,
/tmp)逐项通过git clone(本地传输,dashed helper 经 exec-path 找到)✅pre-commit经 PATH 上的 sh 运行,输出HOOK-RAN)✅git submodule add/submodule status✅git ls-remote https://github.com/unixwin/niu-git HEAD✅--exec-path/config --system --list/ templates ✅gh auth git-credential照常生效;下一版随包提供 git 自带的git-credential-wincred.exe(172 KB,读 Windows 凭据管理器里同名的git:<proto>://<host>条目),但不会写进系统 gitconfig 当默认(避免排在用户自己的 helper 之前)。迁移(重要前置)
layout: flat需要 WinuxCmd/wpm ≥ 1.1.9(旧 wpm 会用裸DeleteFileW去断usr\bin多调用硬链接 → 自锁、报failed to break WinuxCmd hardlink ... Access denied):后续(另开范围,不阻塞本票)
已在 CI 里就绪、下一次发布带上:wincred helper、版本标识(
git --version现在会带2.56.0.windows.2.niugit,之前是裸2.55.0)、/pathmap+/Brepro可复现且不泄露构建路径、裁掉bin/里的 dashed 形式、补齐此前漏发的libexpat.dll(git http-push之前会在用户机上起不来),以及 2.56.0.windows.2 上游基线 + ARM64 产物(CI 已能双架构构建,并会自动更新 wpm 索引的windows-x64/windows-arm64)。验证环境:本机 winuxcmd 1.1.9 + niugit 2.55.0.5(wpm 安装,flat),Intel x64。
caomengxuan666 commentedon Oct 16, 2026
Adding a measurement for the fix direction, since the issue is about launcher cost.
Hardlink vs forwarding wrapper
Same machine, same repo state, Python
subprocesstiming, warm cache, parent is a native process, N=20 after 3 warmups:git --version...\winuxcmd\opt\niugit\mingw64\bin\git.exe...\winuxcmd\usr\bin\git.exe...\winuxcmd\bin\git.exe(new directory)git.cmdthat execsusr\bin\git.exeA hardlink costs nothing: 12.7 ms against the payload's 13.1 ms is noise. A forwarding wrapper costs a full process, 19.4 ms, which lands it in the same band as the Git for Windows
cmd\git.exelauncher (38.7 ms in the same run).The link is location-independent
A link placed in a different directory still self-locates, so patch #3's upward marker probe is not tied to
usr\bin:End-to-end in a real repository (3,942 entries, 30+ worktrees):
status --porcelain,log -1,rev-parse --show-toplevel, andsubmodule status(which needssh) all behave.Caveat that belongs in this issue
A hardlink only helps if something refreshes it. On this machine the live inode is shared by
.wpm/staging/niugit/mingw64/bin/git.exe,usr\bin\git.exeandbin\git.exe, whileopt/niugit/mingw64/bin/git.exeis a second, separate 5.2 MB file, even though the wpm manifest declaresopt/niugit/...as the payload. Any update that replaces one path by unlink-plus-create leaves thePATH-visible link serving the old bytes. Filed against WinuxCmd; the same refresh requirement applies to whatever mechanism this issue settles on.Suggestion
Keep the entry point a hardlink to the real binary. If a launcher is needed for environment setup, resolve that in-process (argv[0] dispatch, as proposed for
sh/bash) rather than by spawning a second executable.fix(wpm): safe self-update swap, install reconcile, semver-aware outd…
fix(wpm): safe self-update swap, install reconcile, semver-aware outd…
fix: clean failure (not 0xC0000005 / wrong ENOENT) when no POSIX shel…
docs: the Using Git page — which git niu uses, exposing niugit extern…
docs: the Using Git page — which git niu uses, exposing niugit extern…