On 2025/05/08 11:57, Stefan Sperling wrote: > On Thu, May 08, 2025 at 09:32:00AM +0000, Klemens Nanni wrote: > > 08.05.2025 11:33, Kirill A. Korinsky пишет: > > > rovert@ had noticed that git out of the box uses as many threads as the > > > system has CUPs. claudio@ had pointed that it is quite bad idea and use an > > > example that ld.lld with -Wl,--threads=1 reduces the configure time by 15% > > > and system time by 40%. > > > > > > So, here the diff which replaces 0 threads to 1 by default where it isn't > > > 1 > > > already, and disabled try to use threads in name-hashing. > > > > Just ship a default config, sysmerge(8) takes care of existing files, if > > any. > > > > This is the system wide config, see git-config(1) for details. > > > > Feedback? OK? > > I prefer a config override to patched executables. > Config files are easier to figure out for users who become curious about > observed differences in behaviour. > > For years now we have been overriding configuration file defaults in the > devel/subversion port (in that case, to disable storing plaintext passwords). > It has never been an issue.
Trouble with a config override is that, once you've set it, if users modify that config file, you won't get any future changes to that config merged automatically. (There is sysmerge -p but it's extremely awkward to use when the @sample'd config has a lot of changes because it doesn't have the @sample contents from the time when the file was originally changed by the user, potentially many updates ago, so it can't do a 3-way diff). In this particular case you can't also do "MIN(ncpu, $some_number)" with a config override either, you have to be pessimistic and use 1, or make things much worse on single-cpu systems. Ignoring tests, the online_cpus value is already used in quite a few places in the code, more than are modified by those 3 config variables (and some don't have a config variable to control them at all afaict). git-2.49.0/builtin/fetch.c 160: fetch_config->parallel = online_cpus(); 2502: max_jobs = online_cpus(); git-2.49.0/builtin/grep.c 1194: num_threads = HAVE_THREADS ? online_cpus() : 1; git-2.49.0/builtin/index-pack.c 2050: nr_threads = online_cpus(); 2054: * max at half the number of online_cpus(), presumably because git-2.49.0/builtin/pack-objects.c 4593: delta_search_threads = online_cpus(); git-2.49.0/name-hash.c 213: nr_cpus = online_cpus(); git-2.49.0/parallel-checkout.c 54: *num_workers = online_cpus(); 63: *num_workers = online_cpus(); git-2.49.0/read-cache.c 2090: * cap the parallelism to online_cpus() threads, and we want 2280: cpus = online_cpus(); 2896: cpus = online_cpus(); git-2.49.0/submodule-config.c 459: fetchjobs = online_cpus();