From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Herman@debbugs.gnu.org, =?UTF-8?Q?G=C3=A9za?= Newsgroups: gmane.emacs.bugs Subject: bug#62352: Very slow scroll-down-line with a lot of text properties Date: Sat, 25 Mar 2023 22:39:34 +0100 Message-ID: References: <51545b85-029c-a6ff-f733-e486f261f6c0@gmail.com> <83355x7sx2.fsf@gnu.org> <08b5f766dd5d453016a7@heytings.org> <83sfdtcab8.fsf@gnu.org> <83h6u9c89f.fsf@gnu.org> <834jq9c4kb.fsf@gnu.org> <83pm8wby5e.fsf@gnu.org> <38eca973-0d1b-cd3b-1602-00d22c8c1afe@gmail.com> <83ileobu0t.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="blaine.gmane.org:116.202.254.214"; logging-data="33685"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Cc: 62352@debbugs.gnu.org, gregory@heytings.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 25 22:40:16 2023 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 1pgBcV-0008Wc-MF for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Mar 2023 22:40:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pgBcJ-00017N-QF; Sat, 25 Mar 2023 17:40:03 -0400 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 1pgBcI-000179-It for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 17:40:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pgBcI-0005gi-AU for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 17:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pgBcI-000614-5Q for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 17:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Herman@debbugs.gnu.org, =?UTF-8?Q?G=C3=A9za?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Mar 2023 21:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62352 X-GNU-PR-Package: emacs Original-Received: via spool by 62352-submit@debbugs.gnu.org id=B62352.167978038423096 (code B ref 62352); Sat, 25 Mar 2023 21:40:02 +0000 Original-Received: (at 62352) by debbugs.gnu.org; 25 Mar 2023 21:39:44 +0000 Original-Received: from localhost ([127.0.0.1]:43601 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgBc0-00060R-5e for submit@debbugs.gnu.org; Sat, 25 Mar 2023 17:39:44 -0400 Original-Received: from mail-ed1-f54.google.com ([209.85.208.54]:37640) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgBby-00060F-B0 for 62352@debbugs.gnu.org; Sat, 25 Mar 2023 17:39:42 -0400 Original-Received: by mail-ed1-f54.google.com with SMTP id cn12so21349077edb.4 for <62352@debbugs.gnu.org>; Sat, 25 Mar 2023 14:39:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679780376; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=u/w+aBXlnVcUfLQkKzUUYwOkIkj/6BarQhIlxUpBcMM=; b=CBxS+UmrPNztnei1LuHQ4oWAdZhklhWOpDUy0dqvfN/pCRLf+BnNVG49BQMN0WMcA5 4uKJ8aGdPhb9ohTcpgd6DYXtLGEdLZsYBDnpiLpmqpolR0rSnbs9Pgv9nH+4Eh73BIoi vahRloAfLJdwWp1d8fbPLEpETAxH0dT78YtF4IjFBdHm9ZXrvW2+YoLYT4rRKRJmZZ8J psFaLPyu8LB+bgT1WZ2kB+MieEwZ1b3cS6GhjNt38JhDugEZn7aH6wzA+zLTn8fsYcXB 6/w34MU1sQwx0KA0MIbnMr07E+58PI4KrPJb6bajUP/QLvQ73jZ35J2pvHNCygtgb0Pz 4hRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679780376; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=u/w+aBXlnVcUfLQkKzUUYwOkIkj/6BarQhIlxUpBcMM=; b=N5Y/QaxcduDRSktpubwpuUJDRB2aDTIoXOnLyHrMfDZjYFVdVtX2sujmaQ2K+/TLqG L2c3RtYJ7ny/n489rBTVQqMI4lCANX+vovk9pQqPD8ffn2fj4F5oz1++03Iio3C+gaXu OBsoSuVKy+A361YYzxEkw9iIFLzlUKgDvEmHo+/7HjONY8SSSn4YTyZrKvlSlOy00UwJ uQmXz57XWQoqLZYBRqYvS14UYdwtqyvAS50dLKnEvl/0FOYS69xlEV8L1UAKP5oJU9Bw Qys8PHRp1AbxmRfIRNS4LbKb6w5i/v93snYxv2EEMAwRVKDmtXqoR2hR5vy5kwvgKSxT uEWw== X-Gm-Message-State: AAQBX9eY1YDi6Ny5omfvWmoPTn1NtKYdIO0LJOwtjr0vPT/H/Y+MWfyg QHnajv4uh/p2kjMIBaj7sbc= X-Google-Smtp-Source: AKy350YK9UFX4zUFo4rRFdFtdHoQofw4sZIqFb32RnpxL0RwNklwjt81xD1OT44oyW9CkN3T/dt34A== X-Received: by 2002:a17:907:c008:b0:8ad:51e9:cd57 with SMTP id ss8-20020a170907c00800b008ad51e9cd57mr8822036ejc.49.1679780376025; Sat, 25 Mar 2023 14:39:36 -0700 (PDT) Original-Received: from [192.168.8.4] (netacc-gpn-204-88-167.pool.yettel.hu. [5.204.88.167]) by smtp.gmail.com with ESMTPSA id x11-20020a1709064a8b00b009342fe44911sm9240652eju.123.2023.03.25.14.39.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Mar 2023 14:39:35 -0700 (PDT) Content-Language: sv-FI In-Reply-To: <83ileobu0t.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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:258630 Archived-At: On 3/25/23 18:49, Eli Zaretskii wrote: >> Date: Sat, 25 Mar 2023 18:38:19 +0100 >> Cc: gregory@heytings.org, 62352@debbugs.gnu.org >> From: Herman, Géza >> >>> IOW, it is not as simple as you seem to think. >> I didn't meant to imply that it is easy. It is certainly not. But, tbh, >> while emacs is fluid most of the time, it can be very stuttery >> sometimes. In my experience, this is usually caused by some lisp code. >> But when it isn't, it is usually caused by some code in this area. When >> I profile emacs, these functions (next_property_change and similar) are >> usually on the top of the list. So it would make sense to optimize >> around this area. Not just because of this issue, but in general. >> >> I'm not necessarily suggesting a cache. Maybe it's better to actually >> always manage additional data structures. So, if a text property is >> added, it's not just set for the specific character area, but it will >> also modify search structures right away. So additional data structures >> were always in sync. Sure, it has some overhead. But if emacs does a lot >> of linear searches (and having a look at these functions, I see a lot of >> linear searches), this overhead will be quickly mitigated by the much >> faster searches. For example, if emacs had a list which only contained >> text segments with the composition property, the current 500-char area >> search will be much faster. > Emacs already handles text properties using an efficient data > structure, see intervals.c. Feel free to suggest improvements to the > algorithms we use there. The problem is not there. The problem is that find_composition is only interested in the composition property, yet it scans all the properties linearly. And it scans it for 500 characters. This file has a lot of properties, this means a lot of unnecessary and duplicated work (because it does this for each character displayed, or something like this). If the composition property had its own list, then this problem wouldn't exist. Anyways, I commented out those lines, the problem is gone, and everything still seems to work. I'll report back if I find some problems with it.