From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Scrolling commands and skipping redisplay, was: Re: emacs rendering comparisson between emacs23 and emacs26.3 Date: Sat, 25 Apr 2020 03:21:34 +0300 Message-ID: <387d431c-a41b-1a53-b6cd-7b237cb38f05@yandex.ru> References: <20200403174757.GA8266@ACM> <838sj8sphk.fsf@gnu.org> <834ktwsmfw.fsf@gnu.org> <83imibqsmm.fsf@gnu.org> <478c2aab-a5fc-61c2-02e2-2d9846b95273@yandex.ru> <83v9m9nltx.fsf@gnu.org> <83tv1rn8fx.fsf@gnu.org> <4f8bb277-b376-97bf-8539-799688d8e66d@yandex.ru> <83eesvmj15.fsf@gnu.org> <6eec7f68-770e-b3b1-4627-6222f3ef7216@yandex.ru> <83ftd9kwlu.fsf@gnu.org> <1de9d24f-eeb7-7d0a-3768-4baba4365066@yandex.ru> <83zhbcdmyi.fsf@gnu.org> <61f565cd-4fee-d48c-a9ef-b78419b3d058@yandex.ru> <83wo6ed4kb.fsf@gnu.org> <464b5639-7790-fdbc-b519-22a6b0e8c016@yandex.ru> <83o8rqaucp.fsf@gnu.org> <83lfmqgpb9.fsf@gnu.org> <83mu75ey3k.fsf@gnu.org> <83lfmlb49y.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="8195"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 Cc: acm@muc.de, rrandresf@gmail.com, emacs-devel@gnu.org, rms@gnu.org, rudalics@gmx.at To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 25 02:22:22 2020 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 1jS8aM-0001yV-4a for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Apr 2020 02:22:22 +0200 Original-Received: from localhost ([::1]:55716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jS8aL-0003lC-12 for ged-emacs-devel@m.gmane-mx.org; Fri, 24 Apr 2020 20:22:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35964) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jS8Zi-00035b-3s for emacs-devel@gnu.org; Fri, 24 Apr 2020 20:21:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jS8Zh-000680-7E for emacs-devel@gnu.org; Fri, 24 Apr 2020 20:21:41 -0400 Original-Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:36335) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jS8Zg-00067d-OR; Fri, 24 Apr 2020 20:21:40 -0400 Original-Received: by mail-wr1-x42c.google.com with SMTP id d15so11829173wrx.3; Fri, 24 Apr 2020 17:21:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=1jh+cqhsVI5U8CCmXFuXOC3rMyP10yEkI1cdUstpRAw=; b=W0/112uYq4B09rgzvFWRhjFEcE04ZQzrB8ilz4jhIcmXLW9oQmz9MYq4yGm+e2xv7A bh0UMCdKNPLeTIg2GdxInyWryUvIQIrL8ohBH6I5EuTM09CLOXw8NDmQMhGrJcmwGx2L 06ySTRw7hEFPZIo4YPhJd2Vq6Wwf6HHFmmeSa9d+rBeElOfpqSC+jewVNRN30Fuq18sz M/vmLe4D2Yt4EZCmEt2m4ODICa8XH5fEAbAf93WG59nrRDiYW/d0HmoWtJH5EkZorVJ+ 1GebI4nc8mj430F0FCPWOs9dvYXFXplXRt2Qr+y/ogzF1hk/QJdrp8A4sYWxaUwGS4Xj a8fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1jh+cqhsVI5U8CCmXFuXOC3rMyP10yEkI1cdUstpRAw=; b=mxU8XsBZCOKX42xFzGcGigdamNv5xSPD3moW0y/DC9flNQTNB5cjUOeKPAfrJY96rT 8d5UuLEOx7T8Dyf34Klgw2GuifQgyRnrCxCvIBWwUO+p4EYd5NudpTjcdvggy6s4MMhj B/Cgi0KBw+KZIpIxCeAv2kdkhxqOw6FCYZetDAgZLOC4Y7yHRfZ0F2ghzQHZbg2wreJC Fc17NpGaeOKIXj4XPjhL7WP2v8InQRnqCMzxRsNYZWIFvESB9i5+CquYstBffg6gAj/b dyG2qKI7FIyAsym6USJVGahgylTBLMr0795r8mJFahYCwJuLv2NJTzBgQtxBaQOAab/M xjjg== X-Gm-Message-State: AGi0PuYJ6IGNAEfaSE1L8KZ43CFmFG6IfxiZVykWXnsc7tHQ8DgH8nz3 dl1EYekgE1wqgkTGq+9sQZh1r6rklrY= X-Google-Smtp-Source: APiQypJEoYfa3YA/MxAuS158N/GDrGqHWZlvDcD8UPCmesbseyeplCnD8uguOmLi03jHNfrzMjdBQw== X-Received: by 2002:adf:f648:: with SMTP id x8mr13781909wrp.257.1587774098225; Fri, 24 Apr 2020 17:21:38 -0700 (PDT) Original-Received: from [192.168.0.2] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id c83sm5590368wmd.23.2020.04.24.17.21.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Apr 2020 17:21:37 -0700 (PDT) In-Reply-To: <83lfmlb49y.fsf@gnu.org> Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=raaahh@gmail.com; helo=mail-wr1-x42c.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::42c X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:247730 Archived-At: Hi Eli, On 24.04.2020 12:51, Eli Zaretskii wrote: >> Do scrolling commands and/or code that calls posn-at-point do anything >> else common with redisplay other than fontification functions? > > "Common" is too general a word to give an intelligent and helpful > answer to your question. I have no other way except explaining a lot > of how relevant parts of the display engine work (below), or else we > will be forever trapped in misunderstandings. (I do suggest to read > the commentary and the code in xdisp.c, to facilitate better > communications. It takes time and non-trivial effort to write these > descriptions.) Thank you for the explanation. I see you also updated the commentary. The people who will come after will surely benefit. > I hope you can now figure out the answer to your question about the > "common" parts. I think so, and the answer is "no". That means performance revolution will have to wait. But this was seriously educational. >> If *that* work (together with fontification) is usually what takes the >> most time during redisplay > > This remains to be shown. Someoneā„¢ should profile redisplay in > relevant use cases and present the profiles, then we could decide > whether this is or isn't the case. Personally, I think it's roughly > 40%-60% or 30%-70%, with the actual redisplay being the larger part. > But humans are notoriously bad in guessing this stuff, so I won't be > surprised if mine turns out to be wrong. Indeed. >> there could be some simple cache added on to of it, which would make >> skipping redisplay unnecessary in cases when the command would >> pre-fill such cache. > > I have my doubts that it will turn out to be simple. Besides my > humble experience of hacking the display code, I have a much more > significant evidence: that such a cache was not implemented when the > current display engine was developed for Emacs 21. Gerd Moellmann is > an extremely capable and talented programmer, and most of the work he > did on the display engine during Emacs 21 development was precisely to > make it fast enough. All the redisplay optimizations we have now were > designed and implemented for that purpose, because without them > redisplay was unbearably slow on the machines we had at that time. At > some point Gerd wrote that he implemented these optimizations one by > one, until he got satisfactory redisplay speed. If there was a simple > way of caching more data to speed this up, I have no doubt we'd have > that already. But 20 years have passed now, and I imagine the complexity of building a glyph matrix and then rendering it couldn't have changed much (maybe proportional to the screen resolutions). The font-lock rules have most likely became more complex in the meantime (meaning, fontification is possible always the slowest part by far). So actually giving up on some optimizations (such as skipping redisplay) might keep Emacs about the same in terms of performance on modern machines, yet improve responsiveness in those cases when it can't keep up with input. But it's a difficult argument to make given we must have some users with 20-years old machines still. And while our developers compile with optimizations disabled (the current master might help improve on this). Seems I should look into throttling repeated keyboard input when redisplay can't keep up instead after all. In theory, it should give about the same increase in responsiveness in the scenarios we've been discussing here.