From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: Excessive redisplay from lots of process output Date: Sat, 25 Feb 2023 07:10:24 +0800 Message-ID: <619913E2-4062-4865-8351-5EADFA4DCC70@yahoo.com> References: <834jrk1dli.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27312"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Feb 25 00:13:46 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 1pVhG6-0006tk-7i for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Feb 2023 00:13:46 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVhFG-0008CL-OU; Fri, 24 Feb 2023 18:12:55 -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 1pVhFD-0008Bk-CO for emacs-devel@gnu.org; Fri, 24 Feb 2023 18:12:51 -0500 Original-Received: from sonic313-36.consmr.mail.ne1.yahoo.com ([66.163.185.59]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVhFB-0001QS-19 for emacs-devel@gnu.org; Fri, 24 Feb 2023 18:12:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1677280362; bh=JpFcM/g8uxoHf7tnx45LoVdIFeGg6F6RWnNCbPssUx4=; h=Date:From:To:Subject:In-Reply-To:References:From:Subject:Reply-To; b=kqvOWGqxj5WbErMeslXU5/ETWnVpmshdP3YFu2sCtbkBG183lXQeM5fskxIdJneRMYlCeilkTQqHN4YvIiMgJ0RB2PWdQwCtNTbzkyvxMmqjFNrwqOA1lL3mXblErH904Nmfkg8dl64d/cVlc1xoONc9q/7YeIcfQOOn8Qv2uvbPaOK7mKP1mLJRopjUritk+zKKNdecHFK0zLXntIUFP/UTjrNeIdfIxrtMc6Nuw0UmGu7kUOisx9Mc4spAF/p8r4T0ys40ZWXFIjMYpGascaBjhc+7nxEQ1BUq45OjkMQ4SOXcFoIjT0mWpv1mwoe5cVhO9U2iBj3lmyIN9qGXVw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1677280362; bh=PiWnXN2ch6eQwDXK+YuPbOPSpLL3/u+3dNOUN72TU+N=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=YxA/pIx8eBenILvkx3GoIDo99EpUkf7YVxXF5c1fOaS6j3tCZZFZ63b4Fh4kS7uwSSMgS6FE3aTXXjzCoDVuzBprWYQga/3tY49W2qeh+R9vgPpYjFVOpjsz5bnIrldhs85IhRz3UFZENeA5nPfFnSfRB61hExbGx5SxawVMNyAbPJuv1H80ybvNUQhppO3d2rZ19Nj5GW2VJufJVF0BjG+jYQXwHdV5Rn5Bmv4nFnglUci0u/a1jOXTT44gJG4iXFs1aFmp9p6Dy4fYZk8sk8H0wVLbH/Tco2CU0Lux9FuxVHb4Qah0/Kc9h3PdO091YAbehP4oX6WtH7bZYyH3vQ== X-YMail-OSG: rO5c1OgVM1nKPUgZHpYorHWQtSOdkfqMpxPC5Z7eXuXcqx_3M6Zs46WDqkFR1Tp PJpBTbfN08p7brMlr.PEy5_F6Fhu_iebcxwD3gQkLk8uC8B8ZDrYeDYrMmETmOmd7iHzmDX1KUzF b_yDYGg0XPW0lH71ELd2JHAQKTWcRzYbpAnwGXi0uZUSPT3UtwpVjpwo5L01qaQUUfnirRkZ0UM_ I0y4IAIDk6glRBLgaJ9S.qmSvt1QpN6HTXUeanAhnfOVzRuT_R7gNstSOC9dpr8Jf2yOhTGmMUQo KHv6mM.XxZpFD8TPzoS4TrtdAWIAUyCkVL5iNTNt8YT1gm0vKq9UOU6fIivcEyaUKpi7x9J_LAzK Bwp2hBahEn80q3h1TyPXm6LoOEF_fixFcHF46EOlyjayE6zNBpCTj4zaHcPlYYLZtRiNDakirnTR b7op3499oPJGYm4bBF1N6nTo08v_UW53VjRj9r.Jzvmt9EWTm2daLHlmg12pooIWHxd5M.44CVmP Xx4OF2CCCovcVGy_JbWZ6OvyHt4qQ2KLMpglVC33ST72BDvGkQZX0WGkYc.GmKU4t4OUPFIX26Gh jHUBxo3Zr_ICucfoo8CNncjYbh_aXOzYiX6_f1vfGii0AJbI1JmRTtjDx2r19acPzo1Y9p8dkfI0 g9p_dc.091tZM34V92IOTCUcR2jWjYmIUmXM3FdGu8zDMbicWFKqLWPn1oqyGSD7MHIntVFzp3NP m0l1kir7ewhcggOBJpObSqrvfe4hx6gJHIQER9y4kFgrETJ2Vj2e4cWC1Vj5Y5wM.Gd7smM2KAL9 PyREiUsn7jCyNapEfuHXtvW_foSj.Iae0NIQQhVQq9 X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ne1.yahoo.com with HTTP; Fri, 24 Feb 2023 23:12:42 +0000 Original-Received: by hermes--production-sg3-9fc5746c8-28mz5 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 56805d2c1bdfb4d1e11ce08666d52c29; Fri, 24 Feb 2023 23:10:40 +0000 (UTC) In-Reply-To: X-Mailer: WebService/1.1.21221 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.185.59; envelope-from=luangruo@yahoo.com; helo=sonic313-36.consmr.mail.ne1.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, 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:303779 Archived-At: XFlush is not too expensive if not many requests have been generated=2E Wh= at is expensive is _XReply, which waits for a reply from the X server on th= e other side of the connection=2E Anyway, please give Emacs 29 a try=2E I tried to reduce the number of loc= ations where Emacs waits for replies, which makes it much more usable over = a network connection=2E Also, try using a no toolkit build=2E GTK has a bug where changing the sc= roll bar waits for replies from the X server=2E If the problem is still there in Emacs 29, please run Emacs under xscope, = and tell which request(s) are being made=2E Emacs should not make X reques= ts when nothing on the display has actually changed=2E On February 25, 2023 3:14:55 AM GMT+08:00, Spencer Baugh wrote: >On Fri, Feb 17, 2023 at 11:06 AM Eli Zaretskii wrote: >> >> > From: Spencer Baugh >> > Cc: azeng@janestreet=2Ecom >> > Date: Fri, 17 Feb 2023 10:16:11 -0500 >> > >> > Emacs calls redisplay every time it reads process output=2E This cau= ses >> > Emacs to become painfully slow when these two conditions are met: >> > >> > - When redisplay is expensive (e=2Eg=2E when using ssh X forwarding) >> > >> > - And when there is frequent process output, say hundreds or thousand= s >> > of times a second (e=2Eg=2E ERC receiving network traffic, shells >> > running commands which log heavily, other things which run in the >> > background) >> >> This cannot be the whole story, because usually redisplay exits almost >> immediately after being called, having determined that nothing needs >> to be changed on display=2E >> >> So the important part of your situation that you didn't disclose is: >> why does Emacs in your case perform the expensive redisplay each time >> redisplay is entered? Can you figure that out by stepping through >> redisplay_internal? (Let me know if you need guidance=2E) > >Actually, I'm looking a bit more into it, and I think there is still >some issue causing excessive X traffic when there's lots of process >output to be read=2E On emacs -Q with Emacs 28, flush_frame/XFlush is >called on every redisplay, and does seem to be actually writing X >requests on the X socket every time=2E > >Here's a backtrace of where flush_frame/XFlush is being called from: > >#0 0x00007ffff4abc5c0 in XFlush () at /lib64/libX11=2Eso=2E6 >#1 0x00000000004d23d6 in x_flush (f=3D) at xterm=2Ec:250 >#2 0x00000000004d2416 in x_flip_and_flush (f=3D0xf956d0) at xterm=2Ec:24= 6 >#3 0x00000000004d2416 in x_flip_and_flush (f=3D0xf956d0) at xterm=2Ec:12= 30 >#4 0x0000000000461374 in redisplay_preserve_echo_area (f=3Dout>) at frame=2Eh:1700 >#5 0x0000000000461374 in redisplay_preserve_echo_area >(from_where=3Dfrom_where@entry=3D12) at xdisp=2Ec:16527 >#6 0x00000000005bee33 in wait_reading_process_output >(time_limit=3Dtime_limit@entry=3D0, nsecs=3Dnsecs@entry=3D0, >read_kbd=3Dread_kbd@entry=3D-1, do_display=3Dtrue, >wait_for_cell=3Dwait_for_cell@entry=3D0x0, wait_proc=3Dwait_proc@entry=3D= 0x0, >just_wait_proc=3Djust_wait_proc@entry=3D0) at process=2Ec:5808 >#7 0x000000000050aea4 in read_char (end_time=3D0x0, >used_mouse_menu=3D0x7fffffffda5b, kbp=3D) at >keyboard=2Ec:3926 >#8 0x000000000050aea4 in read_char (used_mouse_menu=3D, >local_getcjmp=3D, end_time=3D) at >keyboard=2Ec:2198 >#9 0x000000000050aea4 in read_char (used_mouse_menu=3D, >prev_event=3D, local_getcjmp=3D, >end_time=3D) at keyboard=2Ec:2261 >#10 0x000000000050aea4 in read_char (commandflag=3Dcommandflag@entry=3D1, >map=3Dmap@entry=3D0x127fed3, prev_event=3D, >used_mouse_menu=3Dused_mouse_menu@entry=3D0x7fffffffda5b, >end_time=3Dend_time@entry=3D0x0) at keyboard=2Ec:2892 >#11 0x000000000050cc5e in read_key_sequence >(keybuf=3Dkeybuf@entry=3D0x7fffffffdb60, prompt=3Dprompt@entry=3D0x0, >dont_downcase_last=3Ddont_downcase_last@entry=3Dfalse, >can_return_switch_frame=3Dcan_return_switch_frame@entry=3Dtrue, >fix_current_buffer=3Dfix_current_buffer@entry=3Dtrue, >prevent_redisplay=3Dprevent_redisplay@entry=3Dfalse) at keyboard=2Ec:9635 >#12 0x000000000050e390 in command_loop_1 () at keyboard=2Ec:1392 >#13 0x0000000000578754 in internal_condition_case >(bfun=3Dbfun@entry=3D0x50e180 , >handlers=3Dhandlers@entry=3D0x90, hfun=3Dhfun@entry=3D0x504990 ) at >eval=2Ec:1450 >#14 0x00000000004ff4aa in command_loop_2 >(handlers=3Dhandlers@entry=3D0x90) at keyboard=2Ec:1133 >#15 0x0000000000578704 in internal_catch (tag=3Dtag@entry=3D0xe850, >func=3Dfunc@entry=3D0x4ff490 , arg=3Darg@entry=3D0x90) at >eval=2Ec:1181 >#16 0x00000000004ff46a in command_loop () at keyboard=2Ec:1111 >#17 0x00000000005045cb in recursive_edit_1 () at keyboard=2Ec:720 >#18 0x00000000005048e5 in Frecursive_edit () at keyboard=2Ec:803 >#19 0x000000000041e909 in main (argc=3D4, argv=3D) at emac= s=2Ec:2361 > >What could be causing this? >