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#47711: bug#48841: bug#47711: [PATCH VERSION 2] Add new `completion-filter-completions` API and deferred highlighting Date: Sat, 14 Aug 2021 05:55:17 +0300 Message-ID: <328f87eb-6474-1442-e1ca-9ae8deb2a84a@yandex.ru> References: <3d3f894f-a6fa-53ae-5d50-c3aa9bffc73e@daniel-mendler.de> <56ab18b1-4348-9b2c-85bb-af9b76cd429a@daniel-mendler.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39256"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 Cc: Stefan Monnier , 48841@debbugs.gnu.org, 47711@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , Daniel Mendler Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 14 04:56:11 2021 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 1mEjqE-000A4M-BO for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 14 Aug 2021 04:56:10 +0200 Original-Received: from localhost ([::1]:53198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mEjqC-0006Yx-Rg for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Aug 2021 22:56:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mEjq7-0006Y1-11 for bug-gnu-emacs@gnu.org; Fri, 13 Aug 2021 22:56:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60063) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mEjq6-00038i-Pb for bug-gnu-emacs@gnu.org; Fri, 13 Aug 2021 22:56:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mEjq6-0005an-Hv for bug-gnu-emacs@gnu.org; Fri, 13 Aug 2021 22:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Aug 2021 02:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47711 X-GNU-PR-Package: emacs Original-Received: via spool by 47711-submit@debbugs.gnu.org id=B47711.162890972721452 (code B ref 47711); Sat, 14 Aug 2021 02:56:02 +0000 Original-Received: (at 47711) by debbugs.gnu.org; 14 Aug 2021 02:55:27 +0000 Original-Received: from localhost ([127.0.0.1]:43376 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mEjpW-0005Zq-Vc for submit@debbugs.gnu.org; Fri, 13 Aug 2021 22:55:27 -0400 Original-Received: from mail-wr1-f45.google.com ([209.85.221.45]:41909) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mEjpV-0005ZW-9A; Fri, 13 Aug 2021 22:55:25 -0400 Original-Received: by mail-wr1-f45.google.com with SMTP id x10so9434671wrt.8; Fri, 13 Aug 2021 19:55:25 -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=RrMsSouFaapPEAk74ymKj85jn+NHe8o5ot//bYK6Y7U=; b=COd7ecBI7d9wbKFTROI+mvyr0iWMzOONcICvbmCVXLgz+ledAdeUe7APuGkKWgY+Jd cKsB6Jw6eN/FU+3FG1D22/HfwNJ37eVjpsMDWYBDzOFQ33B+gnUrNiWG7HAPSPBVy+TD LIFLJl9g1H6dWbm0aNq9GbrEMbmydt6KJElf76D0Y0ryFayy2XtAhagdDsb82l7IM0Gv AXgGm9CDZUH2mKmqSHTwx0ylFJGJ6STudzscB+U0ktueqX+C9ZE/CBlb8qtoKEikHWHf 5Gig5+TFtb6dIWj1juymBsPFdhWkzWF3UrFHfF+Squ/YfPDI9z/3SpouUUAv8unDrq2J 2rqg== 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=RrMsSouFaapPEAk74ymKj85jn+NHe8o5ot//bYK6Y7U=; b=H8t6MI28Sl2fTK2O/up2bWmS2nA5jTdWxCXMHw/hgaQ8CJ6IjlrgyieaUq18wfzWaP ormbF0YU/riADgVwyVjUdLGqLVopAtKUIudbrwehAa/era4Ni968D0EdyYJEViHr+kMY xI7UEMU4t37EeV7+U2HFf03vpDFyKHoeB5H0zRIbikpvCjBIp4+iS3/kO9q7ySMDW6Er N36ABqbcjdD7heNtjBHKRsLSyO5mkUkr8hxCJe/cVkG1brBWeD21cdduhgd2+KDOIQtg M/RJTlyur1ts58M5pHNttNRB8Q5M0j0hLy6kTHRfYeJw1VQQYb/EyckDzT9cCXFkvrJh 4CqQ== X-Gm-Message-State: AOAM533+KR1BiRY9V2JtmxhPQVfKusq2NE2SrPcn9jFrhGB1VypJuezz xcLAqjo8jnh1E/Qz3ZjR+4Hk+9kaqD0= X-Google-Smtp-Source: ABdhPJxpWonVHMT/qpjjgzVsfYxYiCwu8gMPFaSBLngN8O5F+J1FfE4DFsuty8mw7DKIAbbIYwXJGw== X-Received: by 2002:adf:9c8c:: with SMTP id d12mr6159409wre.71.1628909719415; Fri, 13 Aug 2021 19:55:19 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id i21sm3353014wrb.62.2021.08.13.19.55.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Aug 2021 19:55:19 -0700 (PDT) In-Reply-To: Content-Language: en-US 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:211799 Archived-At: Aside from the mutability/ownership issue, On 13.08.2021 15:05, João Távora wrote: > If one removes these lines, the process becomes much faster, but there is a > problem with highlighting. My idea is indeed to defer highlighting by not > setting the 'face property directly on that shared string, but some > other property > that is read later from the shared string by compliant frontents. I haven't done any direct benchmarking, but I'm pretty sure that this approach cannot, by definition, be as fast as the non-mutating one. Because you go through the whole list and mutate all of its elements, you have to perform a certain bit of work W x N times, where N is the size of the whole list. Whereas the deferred-mutation approach will only have to do its bit (which is likely more work, like, WWW) only 20 times, or 100 times, or however many completions are displayed. And this is usually negligible. However big the difference is going to be, I can't say in advance, of course, or whether it's going to be shadowed by some other performance costs. But the non-mutating approach should have the best optimization potential when the list is long.