www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/01/19/07:57:58

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 50JCvwg01709231
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 50JCvwg01709231
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=DDwEkmnQ
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 571D63858C41
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1737291477;
bh=lv67Q+6CvRZrPQvflkOW+SepeEz6LJhAKKgKzC3qrpE=;
h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=DDwEkmnQwMfRC4mZUSf0iwAtOoAd+34MtTzujj5GsdNuiyONMIKw2sblp91hHLi7q
ViNYerUvS0yfs2LITj4UmBhxiuqm8zwGvm5y12wvnHKYEZ5BOK0sR15xh8ePqO+kfx
iIds1lkVDiJqxHCjSKl6+tSz3DWA3mUijkElOf6o=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6DA443858D28
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6DA443858D28
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1737291410; cv=none;
b=ZnaQGLb7OwdA7pyQBalukQJ5F1hkKHta6Xl1oo5gAxL3hN15AOf3h5ORcpTQUtUAUM7SUNyxYddlCuWHlzr8KwpVgndFCJvBbNy1TSBQyPn1gHptTIC1pXK4zlPvmoEPsJX5fGh13L5VwCsMZaavQsAvSeWE2hlIpkGbXcYzxT0=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1737291410; c=relaxed/simple;
bh=8EZsjBA6ruRJ8Vgom69qNp0VW8mJMGoPRZAWdnGobpk=;
h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;
b=RD5cZnChMhtllDEBAzpI6fdsMrnqa2LWYXCr4pphqM7dyCrOOuomSwgFfXdaHcaqw8ZM0cWRXQjfSnb/8/wwj42x5d2wvuQTsMY06wsVagXaMm8S42B/GAZANX7YRnpJUOiMzpQhJEDLbN1+PhquyXRrr2bRtUEJCIbzQqlTk04=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6DA443858D28
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1737291408; x=1737896208;
h=to:subject:message-id:date:from:mime-version:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=o7Mc8oUqIQoN9PyL6GibDP22z5PHEk2GSQM9Wb5HJnc=;
b=YrFtZfoxyH8RHPAWjnkTyMlqUIax6+NOhSCBPC60nu4uXrPQ1jyI2Sphx7kgd8UFFw
t+irsTKNYVn2ELPHAEUL8xQ+n7LQsoGGuZxcI+KeeCH5Zk7YtfDSXi+4Ezd3LsOpyiEJ
MKZmW05T3dLRF4h6i2PP7q7fmPkEGpiWapO8XKe7IGgIefXy4HEw5dNl0Qub4AA4XC10
NQ/xCyiXu218T+hd8qYz7xNgu+VP9LmuuIY5je271cjKdZiic44AShoZM3adKXvt3/g3
aIZJPlLdSDpWdpjRljp8Qib27k0ECHkGsYTCWhki1Ki4iyDhk3Ri4t6Fppaoby/pDBqF
sGzA==
X-Gm-Message-State: AOJu0YxJNgwPoRXH3HqQ2XgkaIQtGGJbnumEx9oWFt6ab/dqaT4efil4
eqTrMEBejYEJ2A/bJDMmQ6HG0msVzvXQ8e/+yHnPDgZxlWpEFR9X4fSS2TjB6JFS6/XMR2GdD4S
HurqiWi4FSdTJ45xLTUGzuy1iYAmaWscs7EE=
X-Gm-Gg: ASbGncvyrNrB8JvxF5+JjPmU1rqGiaGPVZs5I2b1Ur56jmaLm3A4DDU93aHaFO+LYcf
44Tzc0NyFVjtwKuFnJ31rx66QjVWG7R/iqeSXeXiG/uYXD3/3
X-Google-Smtp-Source: AGHT+IE80o0F0NZNrtHyZ3Kg3pvVE3WrN+bjNWyccQ+BhYEFz4GGWp9gUw+jTC0hFvA7Ccekf3Jtewf/y8tIqljIFpw=
X-Received: by 2002:ac2:4543:0:b0:542:63a8:3939 with SMTP id
2adb3069b0e04-5439c218d3bmr2529725e87.8.1737291407680; Sun, 19 Jan 2025
04:56:47 -0800 (PST)
MIME-Version: 1.0
Date: Sun, 19 Jan 2025 13:56:36 +0100
X-Gm-Features: AbW1kvYrTXBRwwbL0zq87oc7n3W12gc8SQEXwowwzQVnLd05C6iRcQ4hnvkC-nE
Message-ID: <CANM0SV2VaAsQbtwmmwmBmZjbWwnEdvVKGcZSHR02uTow1yV=ig@mail.gmail.com>
Subject: [Improvement] Cache user auth and converted paths for child-processes
To: cygwin AT cygwin DOT com
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Devste Devste via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Devste Devste <devstemail AT gmail DOT com>
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

strace -o strace.log dirname -- /some/path/here

There are 2 points that could make it significantly faster and
shouldn't be too hard to implement?

1) A significant amount of time is spent on user auth (as seen in
various github issues the infamous /etc/passwd nsswitch.conf fix)
Wouldn't it be possible to just reuse the auth data from the current
shell for the subshell, e.g. for
basename -- $(dirname -- /some/path/here)

2) why are unix/dos path conversions of environment variables not
cached? A significant amount of time (15-30%, depending on the number
of environment variables) is spent on the conversion for every
invocation.
However, this would be extremely simple to cache and reusable even on
completely unrelated subshells.
cache key = original path
cache value = converted value

e.g.

```
   44   12839 [main] dirname 16929 mount_info::conv_to_posix_path:
conv_to_posix_path (C:\Users\User123\bin, 0x10000100, no-add-slash)
   44   12883 [main] dirname 16929 normalize_win32_path:
C:\Users\User123\bin = normalize_win32_path (C:\Users\User123\bin)
   44   12927 [main] dirname 16929 mount_info::conv_to_posix_path:
mount[0] .. checking / -> C:\Program Files\Git
   44   12971 [main] dirname 16929 mount_info::conv_to_posix_path:
mount[1] .. checking /bin -> C:\Program Files\Git\usr\bin
   44   13015 [main] dirname 16929 mount_info::conv_to_posix_path:
mount[2] .. checking /tmp -> C:\Users\User123\AppData\Local\Temp
   44   13059 [main] dirname 16929 mount_info::conv_to_posix_path:
/c/Users/User123/bin = conv_to_posix_path (C:\Users\User123\bin)
```

could be cached with key
C:\Users\User123\bin
and value
/c/Users/User123/bin

at least for the current process (e.g. a bash script and it's
children) without risking any noticeable outdated cache issues
(probably even longer, however we want to keep it simple and don't
want to worry about cache invalidation too much)

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019