From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.devel Subject: Re: Indentation and gc Date: Sat, 11 Mar 2023 12:17:30 +0100 Message-ID: <20230311111730.fatow74xnbel7t3f@Ergus> References: <20230310110747.4hytasakomvdyf7i.ref@Ergus> <20230310110747.4hytasakomvdyf7i@Ergus> <87a60k657y.fsf@web.de> <838rg4zmg9.fsf@gnu.org> <87ttyrwobj.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5915"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , "Dr. Arne Babenhauserheide" , emacs-devel@gnu.org To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 11 12:18:18 2023 Return-path: Envelope-to: ged-emacs-devel@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 1paxEv-0001Js-Iu for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Mar 2023 12:18:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1paxEP-0004dj-D7; Sat, 11 Mar 2023 06:17:45 -0500 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 1paxEL-0004ZW-Qv for emacs-devel@gnu.org; Sat, 11 Mar 2023 06:17:43 -0500 Original-Received: from sonic305-1.consmr.mail.bf2.yahoo.com ([74.6.133.40]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1paxEJ-0006GK-9C for emacs-devel@gnu.org; Sat, 11 Mar 2023 06:17:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1678533456; bh=BRrVIlmPvDLYfx+MFFGfb0CuEdudeP3ta6SDqCbPcf4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=DaE2uHIjDia8M8ink599MXJqAXkozFTPRDAicTaXNqMhw720n8Fo9y09avPvjqU/aLMXGijMZg9SfDYTogvIUwMMAEp7eBbIypXwfeMN8LwWPBGozB6HOQLpSBBMZUeLZATgHyTxrzu6xJABR8pfz1VC6SW+5JRHiuQrFhiXKkINFAomgxXHHnZSPvYGFZVgjJif9d9aGaTpyRO5FutZgARqxSipBfajZgC/nn6xH39kM9nUPz8mo4v3YiU8IDEKijVMBJEo3sdR8w9SaWZhV365vZJdB+BHra3LdsVJwfkBh/vA0JcdzyWP6jAYxcEzZM7ygiUQAO7yEWuj60qRzg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1678533456; bh=GSqAmZMSWhdoULhTRM49wJmcj2nC19irnBBL9Zajvff=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=LsPqzEnDXczSG4d/dtG4o11qsTk0XlUtcdWRim0Qa6LXs+AFldD8yd61cxKAdb1/TtdjlxfsuPK61vUoWvCgS8KBo9boUKrqHrviqqQ/InLT7JWbPqq+ccccQ8U8gKc4ZkOzKev+ziB2QBewtFoDSX+e9nIvXVrhCQ3JxXFmA2z28u8ouOIMHHvFlYEcO5/62Pm5e2pncAulsAmX7iztkrknWsrTNs0HRq9jctNnpJxKFCTKlLIDousOcSNCX8MHvGa4NBJStb2e75tM5PP31P/VSrmXdDrU2t+1HTYJyF4Q4c0NAi0DNanGN7WVfOmnXBqZFl3LTq3gLS9GbgbTrQ== X-YMail-OSG: ewLubi4VM1k7JnLIEpgTJk4vxdb49Y9aExsaD7vmdPpLzdg4u4j_qUZISqzKrNK iDi0pxbYjDtk_ACwTCBn7Krfpr4H1d.lp4GrhHtbIXbk4Fvx9hKonkDHxvZvCxiSXGL1TN1Q6bvO cQnlrYZP40dyZ_7u5Hh7GNYFzIJRf05edHaXnIv9fzT4oKUmy0X4uSe7UOeiz1GFRY9flvxTJVZB qHJojzCRLwThz77eAA0cVEeQFxh_nhQF0V0qJMyQ1vFBE9DV2hm6Zrp_jgzFNVD1iO0yJZx_Sbk5 8AkCU_5Qw6TGYPTWsHoJIgRK8ODkNDnVRXK37W1J17JKUEPlNMS6xg8GhsKdJdOz4giW3YQ_LOQS SxiPzNpIJynBDTXvRuQdH6T8qpJwY21hRF9fmaKBHycwL9UtlTRcaaTmNJtScv0xjur.AjwhpEd1 YbiJs_jUdOxFPnqCidv.I_7ldhKjFxEi0KNDkgZQ5mTXCWtuzqb6bcb2gKudXnLtLiSOU3A_woow 9_iOP3uK7yYUb_rQK1dVtW7J.cjdPItsMEQhEam.ylRpNL7dYtv552B4fSTD6wnTXGLErk80spK7 SI6pbJWTYVU3oFssZaqbKtusV52D8LjXJNzrjBa97uazC1RdbbAefTuv5R3PBCM3uN3SVoApHHo_ 8Ev_pQRrPYSsNDYY13GPNXRgRBXVL2wIND6DOPNuROTNiRBaXcT0WTBIb_ns3GMkg2Esz.dHBtVM ttohin5UbiqffcydbXJeFzpWfj.zppDRrETe0_OZl9v3lXxSt1EbqGFA3sJNk77xaXzbbjKwIyoo ym7yn_hNjfr3mJ6kcSZJcE5c3fm4yv636zuNKGmLre X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.bf2.yahoo.com with HTTP; Sat, 11 Mar 2023 11:17:36 +0000 Original-Received: by hermes--production-ir2-5b7d458747-7c7bq (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID cc50a68187f2b0731a619e57764e8ed6; Sat, 11 Mar 2023 11:17:32 +0000 (UTC) Content-Disposition: inline In-Reply-To: <87ttyrwobj.fsf@localhost> X-Mailer: WebService/1.1.21284 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Received-SPF: pass client-ip=74.6.133.40; envelope-from=spacibba@aol.com; helo=sonic305-1.consmr.mail.bf2.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304287 Archived-At: On Sat, Mar 11, 2023 at 10:54:24AM +0000, Ihor Radchenko wrote: >Eli Zaretskii writes: > >>> ;; Make gc pauses faster by decreasing the threshold again (from the increased initial). >>> (setq gc-cons-threshold (* 20 1024 1024)) >>> ;; original value: 800 000 >>> >>> ;; speed up reading from external processes >>> (setq read-process-output-max (* 1024 1024)) ;; 1mb >> >> This can only be done around specific portions of code known in >> advance to be long and GC-intensive. I don't think this kind of >> technique can be used in the situation described by the OP. > >May it be done when loading init.el and early-init.el? >Init files are commonly known to be resource-intensive. They also tend >to trigger GC more because the heap size is not yet very large and thus >`gc-cons-percentage' does not yet take precedence over `gc-cons-threshold'. > >As for "known in advance", may Emacs keep track of how many GCs are >triggered by user commands and then adjust GC dynamically? > Hi Ihor: I have this in my early-init since a few years now. ``` (defconst my/file-name-handler-alist file-name-handler-alist) (defconst my/gc-cons-threshold (* 2 gc-cons-threshold)) (setq-default file-name-handler-alist nil gc-cons-threshold most-positive-fixnum ;; Defer Garbage collection gc-cons-percentage 1.0 message-log-max 16384) (add-hook 'window-setup-hook (lambda () (setq file-name-handler-alist my/file-name-handler-alist gc-cons-threshold my/gc-cons-threshold gc-cons-percentage 0.1) (let ((curtime (current-time))) (message "Times: init:%.06f total:%.06f gc-done:%d" (float-time (time-subtract after-init-time before-init-time)) (float-time (time-subtract curtime before-init-time)) gcs-done))) 90) ``` This reduced my load time by 50% on GNU/Linux (a bit more indeed)... on MS-Windows I am still above the 7 seconds with exactly same config (so more than 14x slower than GNU/Linux... but I guess the problem is maybe outside GNU Linux... antivirus virus and MS process creation slowness.) >-- >Ihor Radchenko // yantar92, >Org mode contributor, >Learn more about Org mode at . >Support Org development at , >or support my work at >