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.devel Subject: Re: Major modes using `widen' is a good, even essential, programming practice. Date: Sun, 7 Aug 2022 21:05:44 +0300 Message-ID: References: <6ae35c9306ade07b4c45@heytings.org> <835yj4xhh7.fsf@gnu.org> <83y1w0w0gk.fsf@gnu.org> <83pmhcvugm.fsf@gnu.org> <651cad2f-3ce3-22dd-0829-38dd3c46ec40@yandex.ru> <83o7wwvsqf.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="36323"; 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: acm@muc.de, gregory@heytings.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Aug 07 20:06:42 2022 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 1oKkfh-0009LE-Sq for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Aug 2022 20:06:41 +0200 Original-Received: from localhost ([::1]:49518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKkfg-0006ge-8O for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Aug 2022 14:06:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKkf7-0005uY-B9 for emacs-devel@gnu.org; Sun, 07 Aug 2022 14:06:05 -0400 Original-Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:34308) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oKkf5-0006Lb-O4; Sun, 07 Aug 2022 14:06:04 -0400 Original-Received: by mail-wr1-x42d.google.com with SMTP id j1so8603067wrw.1; Sun, 07 Aug 2022 11:05:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=+m/WMcEGE5amHg0OfWc5MinBKyhJs4SOosEKlDqNhBQ=; b=OyPDSOrRDJXiCP/Dlh/pMDckeOkAS/ZpfECWIBsqSFx79c1wz4yVjGv5DEYrhxUrp2 y6ydnUYZpway8k1REtYd2s46p/CW/OlFX7EZ0cYrluzDyR5rg3AXT9v4nX0t5C6oP3R0 atFx+ymtWRcPVR/C5WPUsBs9HKvuNHk8Ixj2s/pEW9XTuDaR8uI2Jfpv1kKaZdZ3kaQO CoS6/0jTZVlQy2Apvqx7Ohjg/0Fv2hL/vhdZDljYdfLfCpSXwqQlL6ohxVcElLD+TpA/ eaZtoz7SH6LjZ+jxKSy5ofB9VgMl7+B+uSjf8Cuq7nnCwzRGe/8GjOfVR4fUXsJjp1SL OWyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=+m/WMcEGE5amHg0OfWc5MinBKyhJs4SOosEKlDqNhBQ=; b=EVrfH7djlUiagDW0/l3kX6HPoXFZW1SegTWzEvRHJaExetZAzamd5gWzOO3K0O5TYR R0hEB8Pxx1zXprnYa7zzh8ImsfjMuWlwS6awXbwziRh0jQYhQ4NNOSQyEVn2wNAheQkQ 9x7WgUaC9XbRM6EuJopQfrtRMBu67BNdok28m6/+wdgki3v//3XNHIi3xXo8h6b66vd/ qv8FvAha0rZT+V/0jYOejP5/WRJvBHztiF/53x9Utbxg12FKJOEUsSADYTnLh+9u78+A CuT3HLg/vQgVM9im7nhtj3ql3nW5NbqxtrBQPtnKnejWvD1pmsACTL8iLxMfDGpatizg 2ymA== X-Gm-Message-State: ACgBeo3MWhpYb+OeSL1hZukunK/6QlD6J2TX1OMnQkA4w94nL7uzQWfn Qfs+HEP9id0wswqZZDZqBxRLiKF+uPI= X-Google-Smtp-Source: AA6agR7CVl5gZA1gMrrIvxDhSyq8mAmsBpG85XOT2pPEkkH+Mj6E19lene8hSJ7FEZkrX6FsLfD+IA== X-Received: by 2002:a05:6000:a09:b0:220:638f:3b4a with SMTP id co9-20020a0560000a0900b00220638f3b4amr9612088wrb.626.1659895546407; Sun, 07 Aug 2022 11:05:46 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id e3-20020adf9bc3000000b0020e6ce4dabdsm9556549wrc.103.2022.08.07.11.05.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Aug 2022 11:05:46 -0700 (PDT) Content-Language: en-US In-Reply-To: <83o7wwvsqf.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=raaahh@gmail.com; helo=mail-wr1-x42d.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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" Xref: news.gmane.io gmane.emacs.devel:293225 Archived-At: On 07.08.2022 21:00, Eli Zaretskii wrote: >> Date: Sun, 7 Aug 2022 20:53:58 +0300 >> Cc:gregory@heytings.org,emacs-devel@gnu.org >> From: Dmitry Gutov >> >> On 07.08.2022 20:23, Eli Zaretskii wrote: >>>> What jit-lock/font-lock actually do at the moment is to widen, then use >>>> syntax-ppss, i.e. in effect scan from BOB. >>> Yes, and that's SLOOOWWWW! >> It's not slow on files of reasonable size. E.g. even if we take xdisp.c >> (the file I've seen referred to in complaints on CC Mode's speed), >> >> (benchmark 1 '(save-excursion (parse-partial-sexp (point-min) >> (point-max)))) >> >> reports 20-50 ms on my machine. > It takes 0.5 sec here. Interesting. That would mean that scrolling to the end of xdisp.c will at least take this long the first time around. The more than 10x difference in performance is weird, though. Perhaps you have any ideas why parse-partial-sexp's implementation might behave poorly on your un-optimized build? Some tweak in the code might make a lot of difference. This is an area I can't be of much help with, unfortunately.