From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#66020: (bug#64735 spin-off): regarding the default for read-process-output-max Date: Thu, 21 Sep 2023 10:42:31 +0300 Message-ID: <83led09dlk.fsf@gnu.org> References: <83pm4bi6qa.fsf@gnu.org> <83bkfs2tw5.fsf@gnu.org> <18a0b4d8-32bd-3ecd-8db4-32608a1ebba7@gutov.dev> <83il8lxjcu.fsf@gnu.org> <2e21ec81-8e4f-4c02-ea15-43bd6da3daa7@gutov.dev> <8334zmtwwi.fsf@gnu.org> <83tts0rkh5.fsf@gnu.org> <831qf3pd1y.fsf@gnu.org> <28a7916e-92d5-77ab-a61e-f85b59ac76b1@gutov.dev> <83sf7jnq0m.fsf@gnu.org> <5c493f86-0af5-256f-41a7-7d886ab4c5e4@gutov.dev> <83ledanvzw.fsf@gnu.org> <83r0n2m7qz.fsf@gnu.org> <26afa109-9ba3-78a3-0e68-7585ae8e3a19@gutov.dev> <83il8dna30.fsf@gnu.org> <83bke5mhvs.fsf@gnu.org> <83a5tmk79p.fsf@gnu.org> <937d9927-506f-aa36-94e9-3cceb8f629dd@gutov.dev> <83zg1hay6q.fsf@gnu.org> <451d6012-e5ab-df6c-50e3-dac20b91781c@gutov.dev> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23864"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66020@debbugs.gnu.org, stefankangas@gmail.com, monnier@iro.umontreal.ca To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 21 09:43:36 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qjELX-0005zt-Q7 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Sep 2023 09:43:35 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qjEKt-0006z5-GV; Thu, 21 Sep 2023 03:42:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qjEKr-0006ys-2l for bug-gnu-emacs@gnu.org; Thu, 21 Sep 2023 03:42:53 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qjEKp-0007ZW-OL for bug-gnu-emacs@gnu.org; Thu, 21 Sep 2023 03:42:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qjEKz-0006tY-JT for bug-gnu-emacs@gnu.org; Thu, 21 Sep 2023 03:43:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Sep 2023 07:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66020 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 66020-submit@debbugs.gnu.org id=B66020.169528216526476 (code B ref 66020); Thu, 21 Sep 2023 07:43:01 +0000 Original-Received: (at 66020) by debbugs.gnu.org; 21 Sep 2023 07:42:45 +0000 Original-Received: from localhost ([127.0.0.1]:60965 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjEKi-0006sx-Ic for submit@debbugs.gnu.org; Thu, 21 Sep 2023 03:42:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57146) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjEKf-0006se-Qi for 66020@debbugs.gnu.org; Thu, 21 Sep 2023 03:42:43 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qjEKP-0007R5-Jl; Thu, 21 Sep 2023 03:42:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=w+0GZ/5eXjdtFkS7bVhhktO6ZAl+vYVgjqojSSPvd0k=; b=h72htidNP5Uc kE/RFJOVPAFlRfgDRnkgfHPliQsRXRqwVjv6SMw7zfXP3rkguIMggoJx8CsDtZ1aTh66dcXmSVZIX YUGO4E4y2EeO5gdC2OuirU2+dCmTXQM+qykOZZvAkdCWHVZHAaur1N1Az1l2NARc7KX4y7oKkR+ku 273bvCk4dwujxqRzU9a/uoVrJVHEw72ENFQdskl38kaehT5TiJhSjpakPnCRO9gwizwidZg5evUMy 1cjfnsuitPYqWJTs3/0XZXXD+uyEGu8IU3j8qr4Z+XyUN7uc4UU4AKe9AQjL29MuR8Ko+gr3Ig7vQ gWBIRhz0jqj0c4OhvNxlKw==; In-Reply-To: <451d6012-e5ab-df6c-50e3-dac20b91781c@gutov.dev> (message from Dmitry Gutov on Thu, 21 Sep 2023 03:57:43 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270981 Archived-At: > Date: Thu, 21 Sep 2023 03:57:43 +0300 > Cc: 66020@debbugs.gnu.org > From: Dmitry Gutov > > That leaves the question of what new value to use. 409600 is optimal for > a large-output process but seems too much as default anyway (even if I > have very little experimental proof for that hesitance: any help with > that would be very welcome). How does the throughput depend on this value? If the dependence curve plateaus at some lower value, we could use that lower value as a "good-enough" default. > I did some more experimenting, though. At a superficial glance, > allocating the 'chars' buffer at the beginning of read_process_output is > problematic because we could instead reuse a buffer for the whole > duration of the process. I tried that (adding a new field to > Lisp_Process and setting it in make_process), although I had to use a > value produced by make_uninit_string: apparently simply storing a char* > field inside a managed structure creates problems for the GC and early > segfaults. Anyway, the result was slightly _slower_ than the status quo. > > So I read what 'alloca' does, and it looks hard to beat. But it's only > used (as you of course know) when the value is <= MAX_ALLOCA, which is > currently 16384. Perhaps an optimal default value shouldn't exceed this, > even if it's hard to create a benchmark that shows a difference. With > read-process-output-max set to 16384, my original benchmark gets about > halfway to the optimal number. Which I think means we should stop worrying about the overhead of malloc for this purpose, as it is fast enough, at least on GNU/Linux. > And I think we should make the process "remember" the value at its > creation either way (something touched on in bug#38561): in bug#55737 we > added an fcntl call to make the larger values take effect. But this call > is in create_process: so any subsequent increase to a large value of > this var won't have effect. Why would the variable change after create_process? I'm afraid I don't understand what issue you are trying to deal with here.