From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#56682: Fix the long lines font locking related slowdowns Date: Wed, 10 Aug 2022 18:44:53 +0300 Message-ID: References: <83r11uzs8n.fsf@gnu.org> <14845631-c2ef-8371-8606-c858092e3192@yandex.ru> <83mtcizov2.fsf@gnu.org> <83h72qzheq.fsf@gnu.org> <25717d84-3411-a93a-3620-e04fe0571aff@yandex.ru> <83edxuzemr.fsf@gnu.org> <83a68hzz0a.fsf@gnu.org> <6ae35c93062c589b2e02@heytings.org> <7b7fbad7-55ac-49b8-840f-7f89a7e8771a@yandex.ru> <6ae35c93064b3588974c@heytings.org> <6ae35c9306c515f420d8@heytings.org> <87k07gwkjq.fsf@gmx.net> <87fsi4wiel.fsf@gmx.net> <837d3gs4p0.fsf@gnu.org> <83tu6kqnf1.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35329"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Cc: 56682@debbugs.gnu.org, stephen.berman@gmx.net, monnier@iro.umontreal.ca To: Eli Zaretskii , Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 10 17:46:45 2022 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 1oLnuv-0008zr-9P for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Aug 2022 17:46:45 +0200 Original-Received: from localhost ([::1]:36782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oLnuu-00039i-Bs for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Aug 2022 11:46:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLnuE-00032e-Ix for bug-gnu-emacs@gnu.org; Wed, 10 Aug 2022 11:46:26 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60755) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oLnuE-0004ez-8C for bug-gnu-emacs@gnu.org; Wed, 10 Aug 2022 11:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oLnuD-0003W6-Td for bug-gnu-emacs@gnu.org; Wed, 10 Aug 2022 11:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Aug 2022 15:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56682 X-GNU-PR-Package: emacs Original-Received: via spool by 56682-submit@debbugs.gnu.org id=B56682.166014632313470 (code B ref 56682); Wed, 10 Aug 2022 15:46:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 10 Aug 2022 15:45:23 +0000 Original-Received: from localhost ([127.0.0.1]:50504 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oLntX-0003V9-Iu for submit@debbugs.gnu.org; Wed, 10 Aug 2022 11:45:22 -0400 Original-Received: from mail-wr1-f43.google.com ([209.85.221.43]:42705) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oLntJ-0003U4-J6 for 56682@debbugs.gnu.org; Wed, 10 Aug 2022 11:45:18 -0400 Original-Received: by mail-wr1-f43.google.com with SMTP id z12so18199988wrs.9 for <56682@debbugs.gnu.org>; Wed, 10 Aug 2022 08:45:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc; bh=oer2FYPU36ptpkO3ruB5Q5m5cSVBsBIIP5W5YDVK6B8=; b=RWNCN6OqaSuGnpNUBX3/A0nj26TO8NZY8DT338mi5vuHPNbWaEkeMk7fWmEiPqgFh1 maevYMu4L6RVcgWFlTBLA0qxHERDJMgAAPussKgGnjlOeQwcSfZt/qdcuLsdjz1L1Jpp aHfmu/hQz5KosQGPwjyD7+GORYL2ZXTFaeLESVzoKPxlMXR4ylEmtWCRdH/MWOcQ+g0x ANqzpHTO751Uy0DRGM3opRnlvzj6UQUMvFV8rV3n8+pyDbbjEHD0yFIfL3Yp5SKAEmXu 0VM0toA3wg1k8/wbV+8PwZcvTFOK3EEdChoCOVuHPt8ucTUdaSnipIyY+HIcqI2iOH8F ImMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc; bh=oer2FYPU36ptpkO3ruB5Q5m5cSVBsBIIP5W5YDVK6B8=; b=ZTgH+jIWjTbOwh5YhVThQmUkt18hFm+VhMGNKQvoM0wRzx/L+v5/ChPrsnCD6Pvq9k bRQhivvxdA6UJMyYaR41BvRxb7lfR+XioVx/Vd1dA+L0dIfggj7xhLqTF2eH+CWZV2G8 jU/hjEx2yjFPOrICOOP9Gu7Cl2GfYS0bMNkZFmNqWDfnxvHlOx22/Oli/ZwV6rNO4+oN nIr3+OXC6wVi82TkulBE7cgraWeTND482GIGrV+wmvHKCyF9g5a/zJvNUOBnFMOo2q1R TvWbR9oIDTD2HmwM1vH/eiP3+WV80jNAUzOX2Y0XwHi7ADrST8vSs0/r2CW1jEzuIBrm p50w== X-Gm-Message-State: ACgBeo0qa2SIfxBoOukvx1t+kfMy6fOFsHK0GCW1u5uK4bDNjKx6URpd aLKH11zB6yuh7RCTNbelUWk= X-Google-Smtp-Source: AA6agR40l9CVHGeZ7f0mBRoGidbXaFZe3mGSgUu2j/ihM9x8NvYtQxm47W5y413qDKdhpTKZ1t3ffA== X-Received: by 2002:adf:f882:0:b0:21e:d672:1260 with SMTP id u2-20020adff882000000b0021ed6721260mr18051339wrp.257.1660146299496; Wed, 10 Aug 2022 08:44:59 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id p67-20020a1c2946000000b003a2d47d3051sm3283675wmp.41.2022.08.10.08.44.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Aug 2022 08:44:58 -0700 (PDT) Content-Language: en-US In-Reply-To: <83tu6kqnf1.fsf@gnu.org> 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" Xref: news.gmane.io gmane.emacs.bugs:239305 Archived-At: On 10.08.2022 15:43, Eli Zaretskii wrote: >> Date: Wed, 10 Aug 2022 12:31:24 +0000 >> From: Gregory Heytings >> cc:56682@debbugs.gnu.org,stephen.berman@gmx.net,monnier@iro.umontreal.ca, >> dgutov@yandex.ru >> >>> Inhibiting the BPA is an option if it is known that the buffer doesn't >>> include ant R2L characters anywhere; otherwise some braces/parens could >>> be displayed incorrectly mirrored. >> But is there an efficient way to determine if that the buffer doesn't >> include any R2L characters? > Not without searching the buffer, not that I know of. If the buffer > includes only ASCII characters (which this one doesn't), i.e. its > sizes in characters and bytes are identical, we could deduce that > there are no R2L characters without any heavy lifting. Shouldn't the scanner be limited by the same narrowing that the long-line optimizations create? Given its existing effect on font-lock, limiting bidi searches seems like a no-brainer. Alternatively, I would perhaps propose to perform said searching at two junctions: when the buffer is visited (and the text is inserted and, thus, unavoidably read), and when the buffer is saved (perhaps at that point Emacs might have info about the added ranges, to avoid searching through the whole buffer). The downside would be that the first added R2L character might be displayed incorrectly until the buffer is saved. But the upside would be pretty huge.