From unknown Wed Jun 18 23:13:50 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#77942 <77942@debbugs.gnu.org> To: bug#77942 <77942@debbugs.gnu.org> Subject: Status: 31.0.50; replace-region-contents gets stuck Reply-To: bug#77942 <77942@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:13:50 +0000 retitle 77942 31.0.50; replace-region-contents gets stuck reassign 77942 emacs submitter 77942 Gerd M=C3=B6llmann severity 77942 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 20 11:29:11 2025 Received: (at submit) by debbugs.gnu.org; 20 Apr 2025 15:29:11 +0000 Received: from localhost ([127.0.0.1]:50884 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u6WbW-0007wJ-Oi for submit@debbugs.gnu.org; Sun, 20 Apr 2025 11:29:11 -0400 Received: from lists.gnu.org ([2001:470:142::17]:46074) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u6WbU-0007vZ-0l for submit@debbugs.gnu.org; Sun, 20 Apr 2025 11:29:08 -0400 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 1u6WbL-00029o-Io for bug-gnu-emacs@gnu.org; Sun, 20 Apr 2025 11:28:59 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u6WbJ-0004g9-Sx for bug-gnu-emacs@gnu.org; Sun, 20 Apr 2025 11:28:59 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-39c1efbefc6so1909829f8f.1 for ; Sun, 20 Apr 2025 08:28:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745162935; x=1745767735; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=8NFerJgrcseYYE5CM29jPv07nCRLJD4/uywxmm1qB9I=; b=Y4HBBgbumNEch+ahj+0S9dW8BckzSnM+T2InzICE5HClaB5M6gj/2Pz8fAL49S7jYF Aa24kuk5ufFR1uHkUeF1N+OPfhVSCUvtE8PqXrYkcu9dN5MiIA4r8Wb2VfjDXcmpxnVC IjPeWvYgN1UL4juuNZXZB5zh0yAVEWb5tApiozQmcHcftRYqMEa+VsrAVCkBvj/FyuOs bK4srIbRP4gYpulUXsr792WUXHmb9SKhbe1zkNe93HhGFsyzrx9Sp4IrI10miGJinYKF qWh5Q8/eHR+WBrQHeoR+bsCqiY1XOMkP9ME/iip+3Xyf+Psd1n9jDZeaT22yMPYSZKzh 6DsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745162935; x=1745767735; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8NFerJgrcseYYE5CM29jPv07nCRLJD4/uywxmm1qB9I=; b=E/ZKmsY7e2kZX9zOM8mc97SkOpNC8md8fNJgdsLhQF4Bp+yAzzoC+gdXiDqIU8qFCg jeXGUcjTko8/GXtgVi0kSeEczq5tNUV762HF411ifgvhAM7RpWA6njdcx18pXzO8RRA3 1UQfRqL/DfWc1MiTIQAWPo4r5J1nwhyXoR+GQXcCjAJ8SNUk7L9NVTLTvKNW+LWzjKVM LCh7jxyQZS73C4IBBHhJyQestdqyetUEurc9yZTNTp88PWqhounCN96y8RKkfgpFoXrr bfvqNHs9Kw3C4gEA00WzbAdQiQL/Nhgcib/PTkXUyT6PVeba0jBwommi4lPCLRwZUWrL RFaA== X-Gm-Message-State: AOJu0Yxh0MOT06Rar0N9i1AmMA+pog6iZ7jRNJsxpC1TU4DWs10JR4Hs hN1+BJ0FRtw2j1BpY6o88ywBCaOk+2IHqn7p2yUV5fiGdNtWD75oUwsuzZJo X-Gm-Gg: ASbGnctsFN3o3cKFw0nW/Xg5RgikEXooZ3yA3qhjKLuWx8p1j90s0KPEZNa1UMLQI0T +LVQNCSyPg5kHTkEPMByZovU17xgdJ445sDuR4CLCbtvK2CSGmEisY9qgQNIuFTz6WDxN9hWkxf WtAXbzOGXGBgplXUrgUNE4diAVePM9Zy7TWPhVkYZFCCZOEWrcrBW2oSCkO4jDYWbj2s8XCK8QH 6wRcC7zEd9QmzlQNSHibiptkXGddZJ45Kr/23StSMT3ILoyTmXmhZrw8CInvic1acXZmV3uVr6H vstMiQ8gCh5zVJ5Qoj+luqRsRHJT/uKCNnkJRM6D5Bry9DLSqUTAOLy/pDx7OoBRDoqpEAw4rZF c71AwEWPnCoi7ITxypeZo9j/usyYGgCw+dgaxOwQxRrQUpMG8sOhm0GB6Wfr2 X-Google-Smtp-Source: AGHT+IFbdooWEIjLW4enIp0QMCcmK1FmZ7tRNNBAPA96pqi/rMgdiPaUSGKYMRdfgAd1TLBLIS989Q== X-Received: by 2002:a5d:5849:0:b0:39a:c80b:828a with SMTP id ffacd0b85a97d-39efba5c0d1mr7473955f8f.33.1745162934952; Sun, 20 Apr 2025 08:28:54 -0700 (PDT) Received: from pro2 (p200300e0b720a300c964490db7e76205.dip0.t-ipconnect.de. [2003:e0:b720:a300:c964:490d:b7e7:6205]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4406d6e0183sm101989105e9.37.2025.04.20.08.28.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Apr 2025 08:28:53 -0700 (PDT) From: =?utf-8?Q?Gerd_M=C3=B6llmann?= To: bug-gnu-emacs@gnu.org Subject: 31.0.50; replace-region-contents gets stuck X-Debbugs-Cc: Date: Sun, 20 Apr 2025 17:28:51 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=gerd.moellmann@gmail.com; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) To reproduce with emacs -Q, define this function (defun elb-replace-region-contents-entry () (with-temp-buffer (let ((step (apply #'concat (make-list 2000 "=F0=9F=99=82=C3=A9t=C3=A9= =F0=9F=91=B6=F0=9F=8F=BF ")))) (dotimes (_ (/ 10000000 (length step))) (insert step))) (dotimes (_ 100) (let* ((a (1+ (random (point-max)))) (b (1+ (random (point-max)))) (beg (min a b)) (end (max a b))) (replace-region-contents beg end "=F0=9F=99=82=C3=A9t=C3=A9=F0=9F=91=B6=F0= =9F=8F=BF =F0=9F=99=82=C3=A9t=C3=A9=F0=9F=91=B6=F0=9F=8F=BF "))))) and evaluate /elb-replace-region-contents-entry) This enters an (infinite?) loop that cannot be interrupted with C-g in the GUI version. If started with -nw, C-g eventually crashes Emacs, without printing anything on stdout or stderr. In GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin24.4.0, NS appkit-2575.50 Version 15.4.1 (Build 24E263)) of 2025-04-20 built on pro2 Repository revision: 6fb2a4691f4d53473c0a326d3a6c23df9008b6e8 Repository branch: master System Description: macOS 15.4.1 Configured using: 'configure --cache-file /var/folders/1d/k_6t25f94sl83szqbf8gpkrh0000gn/T//config.cache.master --enable-checking=3Dyes --with-native-compilation=3Dno CC=3Dclang 'CFLAGS=3D-Wgnu-imaginary-constant -Wunused-result -g -g -O0 -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Devel= oper/SDKs/MacOSX.sdk/System/Library/Frameworks -Wno-ignored-attributes -Wno-flag-enum -Wno-missing-method-return-type -Wno-variadic-macros -Wno-strict-prototypes -Wno-availability -Wno-nullability-completeness'' Configured features: ACL DBUS GLIB GNUTLS LCMS2 LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 20 12:07:01 2025 Received: (at 77942) by debbugs.gnu.org; 20 Apr 2025 16:07:01 +0000 Received: from localhost ([127.0.0.1]:51352 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u6XC7-0003C9-JU for submit@debbugs.gnu.org; Sun, 20 Apr 2025 12:07:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37594) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u6XC5-0003As-2l for 77942@debbugs.gnu.org; Sun, 20 Apr 2025 12:06:57 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u6XBy-00009q-IY; Sun, 20 Apr 2025 12:06:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=+oAFvJ4021Bf62RflIJR/U7hSufEv5NECGJ56Stq/6Q=; b=BJq4dI0XaXvBpT3EL1JN ptNJmPnxEYQ2OfuTnPqplWlicNJ0LkbbGFxKmGBUCmQgcD3w0CWGb+nhwlHjfM0jF/ugJ1XHhG2x6 NcxDgbOiqU8TRMrDEhfk7LBSHQeQsSw1wQPD1YkFC3jKzSQD7+dThgbmleJfHDZ6srOJzn8wWPV8B MhGmvYlW9xCCXCoaF9qvHXaghlLfgyVamTsMBRfpgZgVShUm5InL0Xe2YdGRomCw3n+8yMeteQa7d I64lQY/OtqfjFY2wvfgbDsrr0YISYu7cDTGmCZCBP6RlqLAgTRKN6p9NwgwVRgAW6/WzK66vww/dH ZdDou0YpVhmNpQ==; Date: Sun, 20 Apr 2025 19:06:44 +0300 Message-Id: <86plh66cmj.fsf@gnu.org> From: Eli Zaretskii To: Gerd =?utf-8?Q?M=C3=B6llmann?= , Stefan Monnier In-Reply-To: (message from Gerd =?utf-8?Q?M?= =?utf-8?Q?=C3=B6llmann?= on Sun, 20 Apr 2025 17:28:51 +0200) Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77942 Cc: 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Gerd Möllmann > Date: Sun, 20 Apr 2025 17:28:51 +0200 > > To reproduce with emacs -Q, define this function > > (defun elb-replace-region-contents-entry () > (with-temp-buffer > (let ((step (apply #'concat (make-list 2000 "🙂été👶🏿 ")))) > (dotimes (_ (/ 10000000 (length step))) > (insert step))) > > (dotimes (_ 100) > (let* ((a (1+ (random (point-max)))) > (b (1+ (random (point-max)))) > (beg (min a b)) > (end (max a b))) > (replace-region-contents beg end "🙂été👶🏿 🙂été👶🏿 "))))) > > and evaluate > > /elb-replace-region-contents-entry) > > This enters an (infinite?) loop that cannot be interrupted with C-g in > the GUI version. If started with -nw, C-g eventually crashes Emacs, > without printing anything on stdout or stderr. Adding Stefan. From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 21 13:23:50 2025 Received: (at 77942) by debbugs.gnu.org; 21 Apr 2025 17:23:50 +0000 Received: from localhost ([127.0.0.1]:37852 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u6us1-0001bR-Py for submit@debbugs.gnu.org; Mon, 21 Apr 2025 13:23:50 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:62027) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u6urx-0001b3-1j for 77942@debbugs.gnu.org; Mon, 21 Apr 2025 13:23:48 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id D1BEE80898; Mon, 21 Apr 2025 13:23:37 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1745256215; bh=u2RjqeI/MJDEmWhOQ+rv42EvaJqsV5jPsWSwbQb9skE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=MQ3dAL4zRHy7kkkQeFk2AgGQ/EaW4+ZuN+6kCbxAmXOZBA7rZBRW0OEORwSAzt7tR 8FR3uyN/GKpngyvUUbR+TGirBUWEpp8ut0uqEdztLXFCnbUvChJsfZSgRTIcI77HMQ iF8wpDlYGUt82u4yaG6nb46/jPbOngn4pAgDBa1WTkWsB8kYOnBpPf7N60Ku1G/Yo6 IxFZ59LH2rwlQNlTNyBKfvhbHxx4woGoc2zrv/Fge1lftf9tsZ+Ia1KemXJCO9v4od aRQKVR0zcrohyAOSgRNdwyCS26MalbnofQdpgHc4nvDx4L5hBaPkV6OOGP+08FCMpT NF6m4/Zr7vcUA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id D624680758; Mon, 21 Apr 2025 13:23:35 -0400 (EDT) Received: from pastel (104-195-208-18.cpe.teksavvy.com [104.195.208.18]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id AB2E1120371; Mon, 21 Apr 2025 13:23:35 -0400 (EDT) From: Stefan Monnier To: Gerd =?windows-1252?Q?M=F6llmann?= Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck In-Reply-To: Message-ID: References: Date: Mon, 21 Apr 2025 13:23:34 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.064 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77942 Cc: 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > To reproduce with emacs -Q, define this function > > (defun elb-replace-region-contents-entry () > (with-temp-buffer > (let ((step (apply #'concat (make-list 2000 "=F0=9F=99=82=C3=A9t=C3= =A9=F0=9F=91=B6=F0=9F=8F=BF ")))) > (dotimes (_ (/ 10000000 (length step))) > (insert step))) > > (dotimes (_ 100) > (let* ((a (1+ (random (point-max)))) > (b (1+ (random (point-max)))) [ Side note: This should use (+ (point-min) (random (buffer-size))) ] > (beg (min a b)) > (end (max a b))) And this should not be necessary because `replace-region-contents` should accept positions in any order, like `delete-region`. > (replace-region-contents beg end "=F0=9F=99=82=C3=A9t=C3=A9=F0=9F=91=B6= =F0=9F=8F=BF =F0=9F=99=82=C3=A9t=C3=A9=F0=9F=91=B6=F0=9F=8F=BF "))))) > > and evaluate > > (elb-replace-region-contents-entry) > > This enters an (infinite?) loop AFAICT it's not infinite. At least, it does end for me when the buffer is smaller (100000) and it does take more time (but still end) with a buffer of 500000, so I think it would end *eventually*. > that cannot be interrupted with C-g in the GUI version. Apparently the MAX-SECS argument doesn't help either. =F0=9F=99=81 > If started with -nw, C-g eventually crashes Emacs, > without printing anything on stdout or stderr. That's even worse. Eli wrote: > Adding Stefan. FWIW, this problem also shows up in Emacs-28 with: (require 'subr-x) =20=20=20=20 (defun elb-replace-region-contents-entry () (with-temp-buffer (let ((step (apply #'concat (make-list 2000 "=F0=9F=99=82=C3=A9t=C3= =A9=F0=9F=91=B6=F0=9F=8F=BF ")))) (dotimes (_ (/ 10000000 (length step))) (insert step))) =20=20=20=20 (dotimes (_ 100) (let* ((a (+ (point-min) (random (buffer-size)))) (b (+ (point-min) (random (buffer-size))))) (message "replace-region-contents %S %S ..." a b) (replace-region-contents a b (lambda () "=F0=9F=99=82=C3=A9t=C3= =A9=F0=9F=91=B6=F0=9F=8F=BF =F0=9F=99=82=C3=A9t=C3=A9=F0=9F=91=B6=F0=9F=8F= =BF ")) (message "replace-region-contents...done"))))) - Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 21 14:01:55 2025 Received: (at 77942) by debbugs.gnu.org; 21 Apr 2025 18:01:55 +0000 Received: from localhost ([127.0.0.1]:38208 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u6vSt-0004dM-CA for submit@debbugs.gnu.org; Mon, 21 Apr 2025 14:01:55 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:49616) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1u6vSp-0004ct-G5 for 77942@debbugs.gnu.org; Mon, 21 Apr 2025 14:01:52 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-39ee5a5bb66so2927447f8f.3 for <77942@debbugs.gnu.org>; Mon, 21 Apr 2025 11:01:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745258504; x=1745863304; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=s7sN7h6ncdsb1xl7mX2CRIaYFi40LnoT3YprG5kU/a8=; b=Vji0MtiUlQWLFcYHDAdAYvSYxStbwkQfbOXVCp51lH61jm/1EtKtbywpBqsXxRkcqe 6zzLY+6vEcu1ggpQhQpc4fk/gvTwqSJTA9cyzybs3kSczg2sm+YrU3nulSkdZecB5qb0 zyXx6Z2weHUcXXTzT0eCVJZTfuYEYuYEmyHOv2KPThK55+cYOpi0pdGMpkxvTUzkNDvi qxb9GNDQoff+zwMcNyf/aPVVLz7g+fpKo0PwX3Bndbj5rSWS9jVK2TldS9JrK2lS+Z8y PrOe0GLSqw9zWBhjXqydsNXX467t+OHtyT65GwesULorr0FpS+V+kKFSA65yxLqXvFSZ 19SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745258504; x=1745863304; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=s7sN7h6ncdsb1xl7mX2CRIaYFi40LnoT3YprG5kU/a8=; b=LP2pPW6s67AkI0dWp9IcU61gA1SX0X+OtKby1cSGsg5BUwcwx/qtavA1QW8LHPXg3k IZXXahJyZjiKf6SQXMOOOL8aWjiHIWcSTt9RKR3uQSx9FFwh6skb0mcYaKHMTjNOyu5k hvyiYk7ukHz1cb56DuLj+tyfDA3xH44+cObgZhlSmL0Mq9Q8QCrPO+YiaAuO0+CilIDh QNWJhILJh9DNDVmAXPv48VKhX6MZVPR5w6ytDP0E1DfiY2Gufqr6084H0mF/bJtMpsUO DeLZABfT1Tur/r+9aU4aOffDKDTSjQMmUtx0G75mqXh1oCqOJ6JPS0FzlEtRxdIVuYw8 WOLA== X-Gm-Message-State: AOJu0YzvmYSsInrqkav832PqaDkXbR2mcXkZ6G7DyNmP6ABURyNfQRdI VVhZFgHCFdUEVYKWhfbg6854aY5v6WN4ix6o/X4FBEJ/bOa1NyW4X1W7lxid X-Gm-Gg: ASbGncuDJ1Cx0vPL9J88d7eLuQ1X62fTy6UrDF3zAY9RIvah3mV1R6bvFWxVktt36uU VSFiUjHh6NPXoaZ2WtmLwCMTK4EGg5/aBf071iOK6bmqNCuDBgoYCryQxD/00dExILvEplB9p3Z 6oJlMazDZ458SeQg9A4k6EFQGvhD7Hti1u8kOthSDANzlBncdgF7sN7kAIVDY4G2K1Oo19nYEPI t9yyRj0vc5xiZR0EqLRUp7JHDFYM+GTtoAJ/hzIOj58RKl07L6TjTMjvqILUIue+0jz1eJcRjtd u20d1v4jNAZjZKtXRuZMAj0Y4p3VDhN1ihHNdAnpAOVyLdYuIU53jS5Wwo+D/y+jK0JxNQhmsVk 2COIQck5C6eA5eHbSrM69ePqg63VQ91B0OBvdVCcJ7g== X-Google-Smtp-Source: AGHT+IFZTUaraJ0BXWdkAo+EXzaf5You8lLSYIh6dwl/GD+aaaAgBLIli9g4kZ6vSaj1s4yGyvvhww== X-Received: by 2002:a5d:6da1:0:b0:39a:ca0c:fc90 with SMTP id ffacd0b85a97d-39efba3c6e4mr10853114f8f.14.1745258504459; Mon, 21 Apr 2025 11:01:44 -0700 (PDT) Received: from pro2 (p200300e0b728b60058490051f8c259a0.dip0.t-ipconnect.de. [2003:e0:b728:b600:5849:51:f8c2:59a0]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39efa4207d0sm12738557f8f.11.2025.04.21.11.01.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Apr 2025 11:01:44 -0700 (PDT) From: =?utf-8?Q?Gerd_M=C3=B6llmann?= To: Stefan Monnier Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck In-Reply-To: References: Date: Mon, 21 Apr 2025 20:01:43 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77942 Cc: 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Stefan Monnier writes: >> This enters an (infinite?) loop > > AFAICT it's not infinite. At least, it does end for me when the buffer > is smaller (100000) and it does take more time (but still end) with > a buffer of 500000, so I think it would end *eventually*. Just as an observation: I started with 1 run and that seemed reasonably fast, a few seconds, so I made it 100, which had this effect. From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 21 16:32:00 2025 Received: (at 77942) by debbugs.gnu.org; 21 Apr 2025 20:32:00 +0000 Received: from localhost ([127.0.0.1]:39362 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u6xo8-0004Wb-5p for submit@debbugs.gnu.org; Mon, 21 Apr 2025 16:32:00 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:17288) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u6xo2-0004WG-LC for 77942@debbugs.gnu.org; Mon, 21 Apr 2025 16:31:57 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6F74F4412DA; Mon, 21 Apr 2025 16:31:48 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1745267507; bh=wldJA46r3LE0DSzgD+mEOU0s/u9VYZ2uHi0+EPJVkxU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ew8l3gyvjcL1j2mxlvA1hGfkXbe1aOyVYTfsRB6zbjbfGRgIN6ZCfgfZfERzCANG2 ffXz4xaRg6mPJKVStF4OB1PgpOWawHp2kvjtKWmODlYgmPrq/6nBWlvjQUpmdnad2N 24iq+rg1pehOfcJYUGwf64w7oHCGD6UlKBXycKYOKbd+BSWentSs3HMtT/P2Wta7Ha sbf3EX3xnJB+nKyoU+QCTuUgp2bBfQK615KbDBY/qBCdm6U2cE9tGm6+ObX+wEhAhK TLG4WdAwUtNM3JqyfYXm+pzsm2fWiAcM0emU7INzLe91NT1raLJ5/fLb/uLKd/cL7O 8SOYkCQwIpdLg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 45CDB44071A; Mon, 21 Apr 2025 16:31:47 -0400 (EDT) Received: from pastel (104-195-208-18.cpe.teksavvy.com [104.195.208.18]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1DF54120497; Mon, 21 Apr 2025 16:31:47 -0400 (EDT) From: Stefan Monnier To: Gerd =?windows-1252?Q?M=F6llmann?= Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck In-Reply-To: Message-ID: References: Date: Mon, 21 Apr 2025 16:31:45 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.019 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77942 Cc: 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Gerd M=C3=B6llmann [2025-04-21 20:01:43] wrote: > Stefan Monnier writes: >>> This enters an (infinite?) loop >> >> AFAICT it's not infinite. At least, it does end for me when the buffer >> is smaller (100000) and it does take more time (but still end) with >> a buffer of 500000, so I think it would end *eventually*. > > Just as an observation: I started with 1 run and that seemed reasonably > fast, a few seconds, so I made it 100, which had this effect. For the first round, how fast is it depends on your luck with the random number generator since the time depends on the size of the region on which you perform the replace. Try just (require 'subr-x) =20=20=20=20 (defun elb-replace-region-contents-entry () (with-temp-buffer (let ((step (apply #'concat (make-list 2000 "=F0=9F=99=82=C3=A9t=C3= =A9=F0=9F=91=B6=F0=9F=8F=BF ")))) (dotimes (_ (/ 1000000 (length step))) (insert step))) =20=20=20=20 (replace-region-contents 123 (- (point-max) 123) (lambda () "=F0=9F=99=82=C3=A9t=C3=A9=F0= =9F=91=B6=F0=9F=8F=BF =F0=9F=99=82=C3=A9t=C3=A9=F0=9F=91=B6=F0=9F=8F=BF "))= )) - Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 21 16:39:52 2025 Received: (at 77942) by debbugs.gnu.org; 21 Apr 2025 20:39:52 +0000 Received: from localhost ([127.0.0.1]:39425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u6xvk-00050W-8o for submit@debbugs.gnu.org; Mon, 21 Apr 2025 16:39:52 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:44117) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1u6xvh-00050F-00 for 77942@debbugs.gnu.org; Mon, 21 Apr 2025 16:39:49 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-39c1efc4577so2356002f8f.0 for <77942@debbugs.gnu.org>; Mon, 21 Apr 2025 13:39:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745267982; x=1745872782; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xymGMANU8jvTxxhSvHPoprylVGkr1CUDXOZq8kdp+H8=; b=i1H5r/Up8W3rVS/qQukfFcH1+T31o/Tz1zJwykrk77rbjZznLWIdZukWlOd1SKipxJ WJnVMDmrtGLHxD80K13YaYIfmvmBCad5V6pNJD53RwOfYQSA4u0oe4HJDIjI4vDywAot zSRNw5ppqQ6ASwqzHdEie/IVIDjttUKjNDQgNEyXxm3Rl1aj7He9uEFb7Emzzes3Boae kEdLnNjTDAKc7gE0TZUc27fuv1sUSovZSZLiz5Wyw8si5g4uhz0iT7N25+H+NR3yqvSF uvzDQPguQ7IpX14On80TLPGihiunMdQ97pHm6hVJLE3hwsxkaSm3iRhowcJNMRg4xv8r wD+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745267982; x=1745872782; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=xymGMANU8jvTxxhSvHPoprylVGkr1CUDXOZq8kdp+H8=; b=K+7LezHx+Q32OL4Pvtf9hM+ciOdqyHvv7qVQZZmETQ2zdhoHoyZtnQXQrkcakykTJF /6fRa4oDpyJC9HKesrFOPgnkaqMoANN1v5lo6oZpatuaMTxx0RX0ss5ActeQwWbgcaZj g7g9TZo3bT8JR0NTPMMTO14yVyz3BHRNJahxibeu1RBWh9idTfZkIfaXibMAcSF7RdqX /lSGaOOxiVhUaeHmLl1RIKWL/rlloVDA8iNL0sNXoZk3HNvcvUX5v83sQ/9z5WaqOStw cJt691LTsxZnL1eFQyQsvMB7ZxyCOZ9yfmVPsdPinRj9MHNu0J92dWfjpRyb9uXaGCpO V5rQ== X-Gm-Message-State: AOJu0YwCl4v+rMPrmRqdrp/NjuJMZbwLRdfoTHbyKQU9oFMqj4CMrZ6s Fc/FROXazdFuHpVM30Rv/KLFhsKw21IpVPMoBjcPKeQ2FaIb8IqY4h/BFOY7 X-Gm-Gg: ASbGncvgNOf3ZcZ+26HbTOTmM7+308LYLNrL3KDs/cXQrASAgLsZgrebqx2Se9z1Hxh qHKYOysr292kBo5qYuUtamlXCGvEFbtWAX9lc3oikdtGGs5q4kLH/COn/3M0i+hzo0myEY++Aqc lxzMnl8hA/3o+qmp70E+ZXQh38DTkgB9PusGeo/bbNkGkEtnYP7vERMGyZ0wHgv/aS7awAh0O3Y RdZ/WGkIGUAkjygKElTjOl7wuIrg9CnMNmaKpI3lv36dvhZlJrem5bYVTKIwzlaSAXT8Nj1CWJf 7RTCnnUYZylb/5SUkHZgYMayAPjHbBTRvRtYATtCkNTXWNZofPVWlngJIDFg0rBa5JWBbnb1N9c RKAl+mwT3Lt7nmqi8jBZu+DphHVJxoog10Ez56e+/aQ== X-Google-Smtp-Source: AGHT+IHLUSkhKpNXtiZEVz4/67cAsKyZu5ijYQPU87/j66fw91D89yjJqihGd6ZhxDICa/812QG+qA== X-Received: by 2002:a5d:6daf:0:b0:39a:c9cb:819f with SMTP id ffacd0b85a97d-39efbae0e1fmr8938048f8f.37.1745267981880; Mon, 21 Apr 2025 13:39:41 -0700 (PDT) Received: from pro2 (p200300e0b728b60058490051f8c259a0.dip0.t-ipconnect.de. [2003:e0:b728:b600:5849:51:f8c2:59a0]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4406d5cf313sm147806335e9.30.2025.04.21.13.39.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Apr 2025 13:39:41 -0700 (PDT) From: =?utf-8?Q?Gerd_M=C3=B6llmann?= To: Stefan Monnier Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck In-Reply-To: References: Date: Mon, 21 Apr 2025 22:39:39 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77942 Cc: 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Gerd M=C3=B6llmann writes: > Stefan Monnier writes: > >>> This enters an (infinite?) loop >> >> AFAICT it's not infinite. At least, it does end for me when the buffer >> is smaller (100000) and it does take more time (but still end) with >> a buffer of 500000, so I think it would end *eventually*. > > Just as an observation: I started with 1 run and that seemed reasonably > fast, a few seconds, so I made it 100, which had this effect. Just found that replace-region-contents apparently uses a diff algorithm from diffseq.h, and that says The basic algorithm is described in: "An O(ND) Difference Algorithm and its Variations", Eugene W. Myers, Algorithmica Vol. 1, 1986, pp. 251-266, If N is the buffer size and D is the diff size, and both are large, good luck with that. And indeed, reducing the buffer size by 2 orders of magnitude makes things acceptable for my use case. From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 21 16:42:45 2025 Received: (at 77942) by debbugs.gnu.org; 21 Apr 2025 20:42:46 +0000 Received: from localhost ([127.0.0.1]:39451 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u6xyX-0005Gw-Hg for submit@debbugs.gnu.org; Mon, 21 Apr 2025 16:42:45 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:43025) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1u6xyC-0005Da-0G for 77942@debbugs.gnu.org; Mon, 21 Apr 2025 16:42:25 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-43cf680d351so31266665e9.0 for <77942@debbugs.gnu.org>; Mon, 21 Apr 2025 13:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745268137; x=1745872937; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fp1kT3MAtomxeuw2i/f0LujMPIpFqk3xI90zOtsjSK0=; b=TiIsAlPIHCbxoFFFde20HnrwEV9O3yr20xIxNqDpnzP8K1Ufms55Eydc1T8b7mb6oj UG3GsZAzMn2+6eaxLVkW+QpyOMlV50s3B1OVlPJUOUUTBvNQXhm5BSb8bCJxHa2I41VP /b/TiFnnF4R1ZbFebmQUuLneK8I6BigMxwhsU3CtOOvD3TBzn2lyH8xapbc7uwU4Ein9 oIGcjiJ37AednVkQEKqMTPbEeXRd9cZTao4oGn+/WfrDhKiCLxyAZcO2PLtxPJ6nkFx1 yUhy7o+j/LkOM/96AdKhC/j38GpDOaPnrQaCqiSUIWFId4iyy7BPOfrIihF1v9PX9J47 ZezA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745268137; x=1745872937; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=fp1kT3MAtomxeuw2i/f0LujMPIpFqk3xI90zOtsjSK0=; b=S6xn82aDgOzDfdNWLheo2aAAxsn4iHnG2MpVWrfFzYWvFLyZo88IHGJnUyiE6Sv3Fy 9npdmgxNaYTCmWIZnGQmqg4+ql1LnEOdMMj/SGkg+W4apTR9WHDfcEvdqgPRlIh+BFu+ tbPC0rOvNcH17NNR8qDCzPMtAesB+VBRYuc5/rVAz38ocP9LkJnuv+IJZRNiOINarydf 3oBSZtRpi+ZKCnPiFr1ybq9TMrthVg9Mss9A8WI/mp+82OceQh6gjXVmZ743Nn8/A3SE Lnwh5Gx7tzSZw18eiDJjHTbrn2i54fdE46U9ZE8+0FsiatiiRFrV3BcN0PEhf6aFTUdh wWww== X-Gm-Message-State: AOJu0YxiUDmMtSr2Lr5Jd5DR3xieNA7STYe+yfGLZaVse8Fz81zYH5xZ DZVmid6Q02t/LLFrDHcMfpC8uX3sAj6/GMSqmcQRqAqDeqbwfQYSL1tCmebh X-Gm-Gg: ASbGncu+aV1PtB7i0mGc6sXs1z6DBsIHLQeHUvGm8iniIugAqqcp+6Go7rwCRUPih7a ib3TQ2Rj9ekG57vwhGANGg643hpDjrKdf9r6Dr/IO11fP6oOoNkNr/v0r+JBCy839GGCyuwGOfA T+mJPKiZ5ZDaFq2/lnPgUD5cbCnT7l4qs8ZcQO5SzjMu0N1nux+N2pMyQL1rlCeGKDAuA1XiqiV AuJC57lU4MKYje/o7+odNECPpoA36yUSk4K78ozcI7IwZO2vgu7+z0kOSpgEJ8q3wSR3Di2fxb7 2+4AezbNIgumM6vTSuXU+fZm6VAStIuycoGSJNsbKJfNfFHGaXhzd2oQqrE9s/I0SVMfDwCZAUR ewhONeffps8k0vbaQWf7WJdAFd6UguBm7rr5OpCqYgw== X-Google-Smtp-Source: AGHT+IHBaKH6C12/p5bg0ier4G0mvpmFFwAoA4iggT257B/+TXckL4tlmtHiN6e++tPwzYqFom2nxQ== X-Received: by 2002:a05:6000:40db:b0:39c:1efb:eec9 with SMTP id ffacd0b85a97d-39efbd68416mr10529141f8f.13.1745268137293; Mon, 21 Apr 2025 13:42:17 -0700 (PDT) Received: from pro2 (p200300e0b728b60058490051f8c259a0.dip0.t-ipconnect.de. [2003:e0:b728:b600:5849:51:f8c2:59a0]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39efa4330bfsm12830847f8f.23.2025.04.21.13.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Apr 2025 13:42:16 -0700 (PDT) From: =?utf-8?Q?Gerd_M=C3=B6llmann?= To: Stefan Monnier Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck In-Reply-To: References: Date: Mon, 21 Apr 2025 22:42:16 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77942 Cc: 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Stefan Monnier writes: > Gerd M=C3=B6llmann [2025-04-21 20:01:43] wrote: >> Stefan Monnier writes: >>>> This enters an (infinite?) loop >>> >>> AFAICT it's not infinite. At least, it does end for me when the buffer >>> is smaller (100000) and it does take more time (but still end) with >>> a buffer of 500000, so I think it would end *eventually*. >> >> Just as an observation: I started with 1 run and that seemed reasonably >> fast, a few seconds, so I made it 100, which had this effect. > > For the first round, how fast is it depends on your luck with the random > number generator since the time depends on the size of the region on > which you perform the replace. > > Try just > > (require 'subr-x) >=20=20=20=20=20 > (defun elb-replace-region-contents-entry () > (with-temp-buffer > (let ((step (apply #'concat (make-list 2000 "=F0=9F=99=82=C3=A9t= =C3=A9=F0=9F=91=B6=F0=9F=8F=BF ")))) > (dotimes (_ (/ 1000000 (length step))) > (insert step))) >=20=20=20=20=20 > (replace-region-contents 123 (- (point-max) 123) > (lambda () "=F0=9F=99=82=C3=A9t=C3=A9=F0= =9F=91=B6=F0=9F=8F=BF =F0=9F=99=82=C3=A9t=C3=A9=F0=9F=91=B6=F0=9F=8F=BF "))= )) > Yep, I've read the code now, and the O(ND) diffing was, well, a bit suprising :-). From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 21 17:12:11 2025 Received: (at 77942) by debbugs.gnu.org; 21 Apr 2025 21:12:11 +0000 Received: from localhost ([127.0.0.1]:39667 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u6yR0-0007L6-PV for submit@debbugs.gnu.org; Mon, 21 Apr 2025 17:12:11 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:33038) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u6yQv-0007KV-UP for 77942@debbugs.gnu.org; Mon, 21 Apr 2025 17:12:07 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id BBA4C80898; Mon, 21 Apr 2025 17:11:58 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1745269917; bh=OiN9I074ZsED58/qbRqLAJfVOe4bnUIOPJ7sD7EWExo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=hzY6Za1SDoxhD8QBZboJkSFH36awmrOocrlSceSVNxayePwBa+rWiQu/CWEhq3Sin n/EIC7mQOBytKkBED37cCAYRBM/5ej1d8OVcURwjD/jLMIW4CJ0s57dzDkol7+fz9S QjM6ckpEhRIqQu0aw5C40W+UJWsmRFDLrEvakCEKJzcrR5mJKpCaDnPaXDpW91mCQl EqifHXegQlITpJOaSeQMZ3YZtB/xlWSppY+iLra6GT6pn63SYZLM+BYRYh61edjM+C muBbovygtcMMBX2nZ8keocaFwzG0XxxcmeuXfupH79mUloIFmr94zIbfQiOiebGKhD pRUe9T3TjiAwg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id E04B88045E; Mon, 21 Apr 2025 17:11:57 -0400 (EDT) Received: from pastel (104-195-208-18.cpe.teksavvy.com [104.195.208.18]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B180F12064D; Mon, 21 Apr 2025 17:11:57 -0400 (EDT) From: Stefan Monnier To: Gerd =?windows-1252?Q?M=F6llmann?= Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck In-Reply-To: Message-ID: References: Date: Mon, 21 Apr 2025 17:11:57 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.065 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77942 Cc: Paul Eggert , 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > If N is the buffer size and D is the diff size, and both are large, good > luck with that. And indeed, reducing the buffer size by 2 orders of > magnitude makes things acceptable for my use case. And the fun thing is that in your test case, the "inner function" `buffer_chars_equal` which compares two chars (which is the part where the diff code hands us back control so we can check the time against MAX_SECS, and that's also the place where we probably spend too much time doing charpos->bytepos conversion) is called only 74 times, at the very beginning, afterwards there's just a very long processing inside the diff code itself without looking at the buffer contents (or the replacement string for that matter). I actually haven't checked the way the algorithm works, but I get the impression that this is a case that can be optimized further. =F0=9F=99=82 Paul, IIUC you've played with this algorithm. Would you be tempted to try and improve that situation where the replacement text is *much* smaller the text it replaces? Gerd, IIUC you're trying to use this to benchmark the charpos->bytepos code, in which case you should be better served by a call where the text and its replacement are of fairly similar size. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 21 18:32:28 2025 Received: (at 77942) by debbugs.gnu.org; 21 Apr 2025 22:32:28 +0000 Received: from localhost ([127.0.0.1]:40589 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u6zgh-0004hY-TI for submit@debbugs.gnu.org; Mon, 21 Apr 2025 18:32:28 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:35594) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u6zge-0004hG-Mi for 77942@debbugs.gnu.org; Mon, 21 Apr 2025 18:32:25 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 678FB3C010860; Mon, 21 Apr 2025 15:32:18 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id EMdqQuk9znGo; Mon, 21 Apr 2025 15:32:18 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 406513C01086B; Mon, 21 Apr 2025 15:32:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 406513C01086B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1745274738; bh=aXsP4gTrK/HoWSPDpo29K72hqw9ac9dQINrxdbpR4Tc=; h=Message-ID:Date:MIME-Version:To:From; b=JlZM3LQGg+8a0pplisuoZT9lYOS80KXmDjYJOGDUBIJ+0vrkEv9/+Q2K67DdSs/VB siwiHuxuPuqg0Y/9eqV/NR075JaHm3aNSDL8kx1CmHJsfwduMz0Q+pRluatE2gjzPb iR2oXgkdKPSHNNx5m3lcM+GvTxfmfzDG7FZWnD4AerOIcwok/0Sc9hO5A/N+LHyfS1 OfotTnZuCjYvBpFSZR8wU6HKh4a5Hw0DEei0yyjBKWLMxLGIjLM4LD261bDFexNyOg kkNg3KSUZNeUKt3AqT0IVLgty/arhgsljJXVSnKwGhSUz/3N+0KhugwQirDTqUx9Yg X/Tpa8rzZEz7A== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id oboQNOxcYPak; Mon, 21 Apr 2025 15:32:18 -0700 (PDT) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 14CDE3C010860; Mon, 21 Apr 2025 15:32:18 -0700 (PDT) Message-ID: <473f2b98-5962-49cb-ae9b-db6c410043bd@cs.ucla.edu> Date: Mon, 21 Apr 2025 15:32:17 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck To: Stefan Monnier References: Content-Language: en-US From: Paul Eggert Autocrypt: addr=eggert@cs.ucla.edu; keydata= xsFNBEyAcmQBEADAAyH2xoTu7ppG5D3a8FMZEon74dCvc4+q1XA2J2tBy2pwaTqfhpxxdGA9 Jj50UJ3PD4bSUEgN8tLZ0san47l5XTAFLi2456ciSl5m8sKaHlGdt9XmAAtmXqeZVIYX/UFS 96fDzf4xhEmm/y7LbYEPQdUdxu47xA5KhTYp5bltF3WYDz1Ygd7gx07Auwp7iw7eNvnoDTAl KAl8KYDZzbDNCQGEbpY3efZIvPdeI+FWQN4W+kghy+P6au6PrIIhYraeua7XDdb2LS1en3Ss mE3QjqfRqI/A2ue8JMwsvXe/WK38Ezs6x74iTaqI3AFH6ilAhDqpMnd/msSESNFt76DiO1ZK QMr9amVPknjfPmJISqdhgB1DlEdw34sROf6V8mZw0xfqT6PKE46LcFefzs0kbg4GORf8vjG2 Sf1tk5eU8MBiyN/bZ03bKNjNYMpODDQQwuP84kYLkX2wBxxMAhBxwbDVZudzxDZJ1C2VXujC OJVxq2kljBM9ETYuUGqd75AW2LXrLw6+MuIsHFAYAgRr7+KcwDgBAfwhPBYX34nSSiHlmLC+ KaHLeCLF5ZI2vKm3HEeCTtlOg7xZEONgwzL+fdKo+D6SoC8RRxJKs8a3sVfI4t6CnrQzvJbB n6gxdgCu5i29J1QCYrCYvql2UyFPAK+do99/1jOXT4m2836j1wARAQABzSBQYXVsIEVnZ2Vy dCA8ZWdnZXJ0QGNzLnVjbGEuZWR1PsLBlQQTAQgAPwIbAwYLCQgHAwIGFQgCCQoLBBYCAwEC HgECF4AWIQR+N5Kp2Kz31jO8FYjtl+kOYqp+NAUCZiLOewUJHWQLDAAKCRDtl+kOYqp+NHGE D/9Wmbk+cAaQsYLPGBvyzIjZIRzo/V2p3ZwckVA1VEQivx5azu1cs86qDoVIe45AtwmKOvdV wTQd/QeglkZR6D2YPW7UR/7emajyJZZcy+etVTDKoaw1i6/hmd/CpGjUeUSvgoPs6nYR+1lo pSXTpaGrh1W0qQHalSkOOwCHG3HtGk9Ve2AERDUYxmcn8/eZHb7xpUJEJMBBI1bx/zcw1EtB rjsQ1R1faJ/r/7LPAyV36RLvnbX69PylHKQEbJoaY9aUb2Vpm63ni3FeTA7/3jpPvaSRWHJh vPYx6Fm2Ln8pI0Yf/W2B8QMiPTnF/LnH2kvUcf9VXm+1mQJ3fBFU25HZwBhuqZ24IeKymPEt BUMQAum97Dto0jSgR2OUvX7z+twhpQEgRGBzPHYwDi4SxF5Z4Q5Y7B7a++HP9tIxG6CVFIwI 4xVaZud18bPa0YBL+cISmMgxq7h7yoVXl6u3pm9Yiv+W6Lp9QGN8Rw1VuJMOoFCYuoxG8mXO TA5b1jvlQ32gHFFhqErDAhNJRsfgrpe9Gok4Ycp+rWljbvS5Wrl0uth5MP7FbaHN2kmTZibq KXAd//IqczhDyU6qnW6ao+h4iDBDgYgRbQjmToX/vmIdEMzvPGqWXKhe/q1TYMuOO+IfP+bI fyPFH29nVN/o9c4J7myeKvv3HKSXdSVjlh2V787BTQRMgHJkARAApoXrvxP3DIfjCNOtXU/P dwMShKdX/RlSs5PfunV1wbKP8herXHrvQdFVqECaTSxmlhzbk8X0PkY9gcVaU2O49T3qsOd1 cHeF52YFGEt0LhsBeMjgNX5uZ1V76r8gyeVlFpWWb0SIwJUBHrDXexF67upeRb2vdHBjYDNe ySn+0B7gFEqvVmZu+LadudDp6kQLjatFvHQHUSGNshBnkkcaTbiI9Pst0GCc2aiznBiPPA2W QxAPlPRh3OGTsn5THADmbjqY6FEMLasVX8DSCblMvLwNeO/8SxziBidhqLpJCqdQRWHku5Xx gIkGeKOz5OLDvXHWJyafrEYjjkS6Ak6B5z6svKliClWnjHQcjlPzyoFFgKTEfcqDxCj4RY0D 0DgtFD0NfyeOidrSB/SzTe2hwryQE3rpSiqo+0cGdzh4yAHKYJ+UrXZ4p93ZhjGfKD1xlrNY DlWyW9PGmbvqFuDmiIAQf9WD/wzEfICc+F+uDDI+uYkRxUFp92ykmdhDEFg1yjYsU8iGU69a Hyvhq36z4zctvbqhRNzOWB1bVJ/dIMDvsExGcXQVDIT7sDNXv0wE3jKSKpp7NDG1oXUXL+2+ SF99Kjy753AbQSAmH617fyBNwhJWvQYg+mUvPpiGOtses9EXUI3lS4v0MEaPG43flEs1UR+1 rpFQWVHo1y1OO+sAEQEAAcLBfAQYAQgAJgIbDBYhBH43kqnYrPfWM7wViO2X6Q5iqn40BQJm Is58BQkdZAsMAAoJEO2X6Q5iqn40Q68QAJ9GubS/ej30Vc4idoZdc0IyMcL7kQJbMohF+Tyn ZE+TGn9WvzP10yLyzoI0vNlcNfP92d2MS//pFjOuANb5mwyiEYA+rDZIdS4ZZpHxCs2sxMC4 afLCf3kv4aMnTeBvb9na403dlczz9cAacvsmniSFdpb1+BzMpYbybglU5oYMGhYT2nnCRjXN 6S2nKYt4mjJeeOuxHrdeqQQdVBNYeNfTcPePeqvZ2+bD6u9yxZtaV+wxdpqglosQvjqhOYz7 h50/ZTSq70/npoCq44TzdJKttaYvlW6ziRz0g4RRAqZyoxjYXiy5qj8r8zXJuB11ApZCGuKn /usbji9RYbflAhxFeh4LMmpDVi6BrF30b73Md59K7PuEKN1NxzlWiqqQHZZ9momN0GXLPcGq 4uyfq7yVEy7wP5PMOh6oqscKklE3gFQtq0P1Ki0xqdF6Fq5LPJc+0Db2CYkVIy7Xaa/f74I3 sOfQfEeDylVXR5iDfUJEYv/0DYhOr7q5/0b1kh3M4wkrB4C5jVNHjIIj+RsAK90c3t38OhAl jiSN7Bkwy24Afy8eIu6wWzvhnsQGpZPB+IffmxT1wkTy8UxZKjUWV0C82iphVgCUUi2f9sDV Q/tNcwVWmOS+gdv9Wk6tdGeM+Ee+Qs6YG05jcSoajzF0TL07ajLcayRq2j1Os2CtQ8qu Organization: UCLA Computer Science Department In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77942 Cc: =?UTF-8?Q?Gerd_M=C3=B6llmann?= , 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 4/21/25 14:11, Stefan Monnier wrote: > Paul, IIUC you've played with this algorithm. Would you be tempted to > try and improve that situation where the replacement text is*much* > smaller the text it replaces? My quick reaction is that you'd need a different algorithm than the Myers-Ukkonen algorithm used by GNU diff etc. A good place to start might be here: A. Andoni, R. Krauthgamer and K. Onak, "Polylogarithmic Approximation for Edit Distance and the Asymmetric Query Complexity," FOCS 2010, 377-386, . ... though this is just the tip of an iceberg that I haven't had time to look into. If there's real interest in this (it'd be some work) I can ask a colleague who's more of an expert.... From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 21 22:48:01 2025 Received: (at 77942) by debbugs.gnu.org; 22 Apr 2025 02:48:01 +0000 Received: from localhost ([127.0.0.1]:42133 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u73g0-0007br-Jw for submit@debbugs.gnu.org; Mon, 21 Apr 2025 22:48:01 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:31282) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u73fy-0007ba-5A for 77942@debbugs.gnu.org; Mon, 21 Apr 2025 22:47:59 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id DBBF6442531; Mon, 21 Apr 2025 22:47:51 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1745290050; bh=UnzWPZGfv4H7ox9xzb+O9WCPBFf/jWati9Lq5r2iTW0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=XcJRppUknvYE5B0JjUVh0kHvZWrXiW2kB3M+QH9ewYZQrPo74SXogxcqCJDJh7I2P 4vSVtuVvQmzGB7cG/n5Q3i4pCZ0qKmHYmKN2Ou+mpK3lD+Wel8aOhTDJe5qsFYHATG IpGC7qR3Av295hX/CqljddeKZoonU92Ahkjsa5LRpnpXp7btfJA14H6hFMZ1wykdEA wC+oYnafKJv/Q0UuV82k3rkspwvO2ds2OZ9b9phHtEY4dpi0NZFUzYJEO7mgXEe+V+ gLGLPCDD5Gn4adi36m28Q46w/JdupBmL9if1x8MlYuLq4xv6+npCinJtuC2viz7XK2 jBSbWwghWRx8A== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B7769442297; Mon, 21 Apr 2025 22:47:30 -0400 (EDT) Received: from pastel (104-195-208-18.cpe.teksavvy.com [104.195.208.18]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 88EF71201DE; Mon, 21 Apr 2025 22:47:30 -0400 (EDT) From: Stefan Monnier To: Paul Eggert Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck In-Reply-To: <473f2b98-5962-49cb-ae9b-db6c410043bd@cs.ucla.edu> Message-ID: References: <473f2b98-5962-49cb-ae9b-db6c410043bd@cs.ucla.edu> Date: Mon, 21 Apr 2025 22:47:22 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.019 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain KAM_SHORT 0.001 Use of a URL Shortener for very short URL X-SPAM-LEVEL: X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: 77942 Cc: Gerd =?windows-1252?Q?M=F6llmann?= , 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) >> Paul, IIUC you've played with this algorithm. Would you be tempted to >> try and improve that situation where the replacement text is*much* >> smaller the text it replaces? > > My quick reaction is that you'd need a different algorithm than the > Myers-Ukkonen algorithm used by GNU diff etc. A good place to start might be > here: > > A. Andoni, R. Krauthgamer and K. Onak, "Polylogarithmic Approximation for > Edit Distance and the Asymmetric Query Complexity," FOCS 2010, 377-386, > . > > ... though this is just the tip of an iceberg that I haven't had time to > look into. If there's real interest in this (it'd be some work) I can ask > a colleague who's more of an expert.... I don't think I have the time&energy to look into it. But the issue at hand is that in Gerd's example, the diff code takes a *really* long time (even though it has already found an optimal answer, AFAICT), and more importantly: without calling the XVECREF_YVECREF_EQUAL function, which prevents us from aborting the operation with a timeout. For example, if I interrupt the execution I found it is in `diag` in the following loop: for (d = fmax; d >= fmin; d -= 2) { OFFSET x; OFFSET y; OFFSET tlo = fd[d - 1]; OFFSET thi = fd[d + 1]; OFFSET x0 = tlo < thi ? thi : tlo + 1; for (x = x0, y = x0 - d; x < xlim && y < ylim && XREF_YREF_EQUAL (x, y); x++, y++) continue; if (x - x0 > SNAKE_LIMIT) big_snake = true; fd[d] = x; if (odd && bmin <= d && d <= bmax && bd[d] <= x) { part->xmid = x; part->ymid = y; part->lo_minimal = part->hi_minimal = true; return; } } where (in our case when we replace a very large region with a short string), the `y < ylim` is apparently always false (once the first 74 calls to `XVECREF_YVECREF_EQUAL` took place): (gdb) p x $1 = 51823 (gdb) p xlim $2 = 489755 (gdb) p y $3 = (gdb) p ylim $4 = 14 (gdb) p x0 $5 = 51823 (gdb) p d $6 = 41094 (gdb) p x0 - d $7 = 10729 I don't understand this code enough, but I get the impression that we might be able to streamline this loop once we get to that state because every iteration seems to do very little useful work that does not change between iterations (clearly this depends on being able to detect "that state", which depends on the `tlo` and `thi` we read from the array, so it might require keeping track somewhere of the min/max values stored in the `fd` array?). The same probably happens for the loop that follows (and does the same but for "the bottom-up search", according to the comment). I'm hoping you understand enough of the algorithm and of what I'm saying to be able to tell me if I'm making sense. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 21 23:48:26 2025 Received: (at 77942) by debbugs.gnu.org; 22 Apr 2025 03:48:26 +0000 Received: from localhost ([127.0.0.1]:42561 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u74cU-00034G-G3 for submit@debbugs.gnu.org; Mon, 21 Apr 2025 23:48:26 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:53577) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1u74cR-00033y-Lx for 77942@debbugs.gnu.org; Mon, 21 Apr 2025 23:48:25 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-391342fc0b5so3789498f8f.3 for <77942@debbugs.gnu.org>; Mon, 21 Apr 2025 20:48:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745293697; x=1745898497; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=0ILVcbIRzVj4pDoIpWwy0KO2u10/toVUV8ySsinkCbU=; b=XC9oq3SLwcivQrT5N2rwqR2Ds9EGHCdchhTtBR86OH43yLuWAxA9L3RYtnErGkLkiV 9F63kcKB1aVmzP1WRSoiXVmpUwBsVOxdBSmMsy4B3QInE2BbJAxyFdVSA+i9D2SlrKJg HM9/CQsBrJ8vCGk3DFIg8icfNE+uCiyeFiZ1dE/aMNmKL6ZHE75+MFxuGpEBpI9AoXzI uCZBM2kjvIUOgMUufNqkwQ9F6uXGO5jvx+/l531sk+fp8KhBOAPEX57/LHSCtY9BaLr7 ok5MkvXRnB9jYQYaKmHp0abjUAHsi5V1BcwEEM4NsO2NX52ajzR+PLMa+3pykzeAvOFa ny3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745293697; x=1745898497; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0ILVcbIRzVj4pDoIpWwy0KO2u10/toVUV8ySsinkCbU=; b=E8m8lHCjG+tUMs2mjQbfPMoItqa123dB4Y5Fg+cIKvp+0oMvi5ndaRGagRJCR+f2Jb bJdg2uHZTyrPD0REt+GaKPASZOmQK8fFyUP/hmo+sfurCFwuQ+U4HNgED+MAwz43HV/3 DfyCqNcDnaP2XQ97EzKoU/qVtP4o7EdgfzNldXw1GqTfHU8P4CTW2hWIg4qQooQIH0WQ MN+3sL4u/YeRCbWqhKJWKM/n59L5XdQPSzJjAC32tH1GTAXCiqaxpjTKABShkJe9Pkip TXZOu5MW9CLp8rqQi21lRkMMlwiPxtDmkdfjy8pcxwT1FMourXEIf6J+I/BUir7r0iiW u7Zg== X-Gm-Message-State: AOJu0Yw2bApZMI7TW9USMGEW7406RoX9TqdA/jZtd/fsFC8PdIf+Ts20 yR9avvsa0+zF/Lxfy6L8XZ2R3ksulEoEN3L5PbjvIvQ3W1h8fJiK X-Gm-Gg: ASbGnctad6S0JgFcxQ3CGMiiXxkWxOxd1i/pU82C9r+mlHO+W4LvGsNPqSeWbj/gxJ3 yM7zdkZ8RobL6Q3UlFTnxPJXBPcsuhNEifSDAExvqVoug1SdS121hhUiJv9uRSJWpySdie+Y92e x/O41vgja7s9Rbr+CCl6sVofcEg0a3X6qnvst8mL7QYu36RPkusCrO7uS/PuXER9mKXHpngAdp1 rPr22dXFFLPx9T5v/fImss9198Pg+sfnMjajz1qBRvIo1aSC+REsnE2g/MKNxoRRqhJyHSULY5T 0n1CDHymGdl5aElhALsT3lY3CoZCKhtmpv2Lj30JJqpKTP/Yaw8DaUnwXDx/ybWlf/JPAotUgXR ab+RhPzDbosjwaGmvAvgfE3TLc54gAnUzQqie8X0lt2z8thAbzS/5AdU= X-Google-Smtp-Source: AGHT+IH0h3e+1SP3dD4jFh5yY+GFYQ5jQO5DF4uQq5n8dLz7FYCTdv7LVV5sillOFgXuUwGzbs/vYg== X-Received: by 2002:a05:6000:240c:b0:39c:1257:cc25 with SMTP id ffacd0b85a97d-39efbb0938emr11748378f8f.56.1745293697046; Mon, 21 Apr 2025 20:48:17 -0700 (PDT) Received: from pro2 (p200300e0b7301900b98b74cfc94b2689.dip0.t-ipconnect.de. [2003:e0:b730:1900:b98b:74cf:c94b:2689]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39efa4332b2sm13861994f8f.30.2025.04.21.20.48.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Apr 2025 20:48:16 -0700 (PDT) From: =?utf-8?Q?Gerd_M=C3=B6llmann?= To: Stefan Monnier Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck In-Reply-To: References: Date: Tue, 22 Apr 2025 05:48:14 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77942 Cc: Paul Eggert , 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Stefan Monnier writes: > Gerd, IIUC you're trying to use this to benchmark the charpos->bytepos > code, in which case you should be better served by a call where the text > and its replacement are of fairly similar size. That's right, it's for a bencnmark that helps me to get an impression if avoiding the binary search in the charpos -> bytepos case is worth it. Now that I know what replace-region-contents does, that's no problem. But honestly, what the heck? Does someone know what this diffing is about in the first place? I mean, that replacing a region takes O(ND) is not something that I would have thought possible. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 22 07:34:42 2025 Received: (at 77942) by debbugs.gnu.org; 22 Apr 2025 11:34:42 +0000 Received: from localhost ([127.0.0.1]:46477 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u7Bti-0005fa-2M for submit@debbugs.gnu.org; Tue, 22 Apr 2025 07:34:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48782) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u7Btf-0005fF-OM for 77942@debbugs.gnu.org; Tue, 22 Apr 2025 07:34:40 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u7BtZ-0007T3-J9; Tue, 22 Apr 2025 07:34:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=BCxIuJSYEgv8gnLodmXrqBckhxcID5uWFDVSYqZfA/8=; b=MAEQ3py7ZjYFuRHoLkQA cnhHQI0avByfGmkrAjimEhHbw3XkXzfBiCwEa9QkhTjBZ2hqqlOZUOhvbfLh1KrrXDBfVwTIB9MEb GByvEVT+Mf1k/fJphNJnwalnVJ/qTIvXxHtYXWhY0Qd/H7T4YFMCkOgGaPSmOuXAEi3x7/YvyI7xj PdBpGgeyh3MbHjlY57ZYkQpuqJra0RqGSZFGp95ZCuXX/HsaEBOMjd1OeD/kIV3cSk7ZcAVvi/CY7 WhEwm4NpalJni3mP3iCRkW6Fml0yrlqUTMLHSmL9iDv30AS8PM4XJ094yHimQRqX9++AdA8GO+v00 AJ9QA4ih2dYNMQ==; Date: Tue, 22 Apr 2025 14:34:30 +0300 Message-Id: <86sem02zw9.fsf@gnu.org> From: Eli Zaretskii To: Gerd =?utf-8?Q?M=C3=B6llmann?= In-Reply-To: (message from Gerd =?utf-8?Q?M?= =?utf-8?Q?=C3=B6llmann?= on Mon, 21 Apr 2025 22:39:39 +0200) Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77942 Cc: monnier@iro.umontreal.ca, 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: 77942@debbugs.gnu.org > From: Gerd Möllmann > Date: Mon, 21 Apr 2025 22:39:39 +0200 > > Just found that replace-region-contents apparently uses a diff > algorithm from diffseq.h, and that says > > The basic algorithm is described in: > "An O(ND) Difference Algorithm and its Variations", Eugene W. Myers, > Algorithmica Vol. 1, 1986, pp. 251-266, > > If N is the buffer size and D is the diff size, and both are large, good > luck with that. And indeed, reducing the buffer size by 2 orders of > magnitude makes things acceptable for my use case. You should be able to cut your losses by passing a sufficiently small number for MAX-SEC, perhaps even zero. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 22 07:37:27 2025 Received: (at 77942) by debbugs.gnu.org; 22 Apr 2025 11:37:27 +0000 Received: from localhost ([127.0.0.1]:46495 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u7BwN-0005rk-Av for submit@debbugs.gnu.org; Tue, 22 Apr 2025 07:37:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42434) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u7BwJ-0005rC-Iy for 77942@debbugs.gnu.org; Tue, 22 Apr 2025 07:37:24 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u7BwD-0007mN-Fn; Tue, 22 Apr 2025 07:37:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=YgGYQJ0ilRnooA8GQLjrUVFtBUmUSvXfVvZA3piM2uA=; b=UF6ikEo5JOMHzYxClAL5 Ds+dTW+67PPcC1Yi41A+USXqcZ3pIzHpTT7B1Dbqj+UKGo5HyTlCapTQ0CtjGi3JnO5lAyyKdmid8 /fJvf4pxUIFpg1Je66wFeiPew3VfuuM31udvL6AgYvaCETxERGUU0UdTNmNwYoaS0AKAPUKhU9GFX o9Va6JAr4fCkc/mGL+i5Jag5i5Pqj7mgE33S0Kn4etOhVrIZV+1ifhZt1kRkpZBPzwLVYZa/Mf9If XRri/jtd/gjhKRWLAYtYc3gFHwBrHZKyKJBS64aL2ST4dIwqHB7ANuKALChKJW1rN+oXmcPYekysY A9AHEFY9p76jPQ==; Date: Tue, 22 Apr 2025 14:37:13 +0300 Message-Id: <86r01k2zrq.fsf@gnu.org> From: Eli Zaretskii To: Gerd =?iso-8859-1?Q?M=F6llmann?= In-Reply-To: (message from Gerd =?iso-8859-1?Q?M=F6llmann?= on Tue, 22 Apr 2025 05:48:14 +0200) Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck References: MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77942 Cc: eggert@cs.ucla.edu, monnier@iro.umontreal.ca, 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: Paul Eggert , 77942@debbugs.gnu.org > From: Gerd Mllmann > Date: Tue, 22 Apr 2025 05:48:14 +0200 > > But honestly, what the heck? Does someone know what this diffing is > about in the first place? It's about leaving the unchanged portions of text intact, including their properties, overlays, markers, etc. I believe the doc string says that much. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 22 07:42:29 2025 Received: (at 77942) by debbugs.gnu.org; 22 Apr 2025 11:42:29 +0000 Received: from localhost ([127.0.0.1]:46538 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u7C1E-0006AY-La for submit@debbugs.gnu.org; Tue, 22 Apr 2025 07:42:28 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:49164) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1u7C19-0006AA-Qe for 77942@debbugs.gnu.org; Tue, 22 Apr 2025 07:42:26 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-39ac8e7688aso3013676f8f.2 for <77942@debbugs.gnu.org>; Tue, 22 Apr 2025 04:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745322137; x=1745926937; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7bA9XELWNSGx8XzAXrFpAkwfuoY6j71UT/O3+AOBmGA=; b=md9s12NsyGWdqp93YUl0Tc3FQQU4i05zELwO04BrULFJjCK19s6Hwec7ejdCcSBfkX ms9fj4Cey6f/MyZyAMUCOj2qYjTTAm+L3hO9JmTUx2sgsdO5yK3A9lae4tMaE2ji6Y9g H789zPkyBgYcgOf5Jsf1rk8DKAKzqZMTVXJ64Kk0GUxCHhqtk6Hab41aGLEyqOJF1cMS u75vTIiuGRKr12TU1NbJ1xIS4pzakOJMsH++ds2XAkMtNnQ+9dBiiZ3KUhKAsDTwAu72 twUdCCx903oJDXsPRcLxp4W+EOuA9EGvT5pvuaEV2Uad5kQnpQ32mFVQTo4NWEaaVTI2 e8gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745322137; x=1745926937; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=7bA9XELWNSGx8XzAXrFpAkwfuoY6j71UT/O3+AOBmGA=; b=jvT4qKQ2XU/4oGnxyXFNfRVvRuWH4Wba4T7/9g2mwPXbNg/8SnOocdeGqv/ot4Z5N2 ERRMBPsndhxTX3oCtH4JLYyyKBXEW8NY73NZnbXxLBdUs9fOV1k1OCfN5KgDdZALNFKt 9F9+wKCT9gnoSP87PuIBP7Kq0CdMeznaOwpck1znxTK13pTFqsGUMpmB4U5zulWESXJc hWPslshUm8ael4x41+MgjQz3q3YAI6qGEG8EXRk2SlHiMc/mk7nGF+FizrdTRzfYs2Om 0o+r5b9p4sOWnr9g2CYMrjjHMg+cqSbd7Ia37PC5dxhLx6hzI4DpwILH0riBwoxUbL+L Xjmw== X-Forwarded-Encrypted: i=1; AJvYcCXLb+YGpEIJddwaqZPexi5/ywvQp2jXLCH2OrU4TbHw+ZGbfYdhVZ/R7kTf+Z1mk57o4awd2w==@debbugs.gnu.org X-Gm-Message-State: AOJu0YxIzKn2sPMPo3aVMNTibSwUbB39882Awg/iT0QsO0yJ55KXg5In hAB0d72HtTIawziZMvskKSmnJJnEZjAqCsbQjMg7bKLasPkHfRy+gWY/TA== X-Gm-Gg: ASbGncsEzj49xFz7+3yZua2/SnaXt+1mtI3BkB2uOcRfF9z/hAYvAld8bByZWWPC6B4 jTooZ3bAn23Xp2qmmPo4CP/QvBwIHwGB8/dJ8tDNRlBVltzTjc9tGzLsP9V+PlJpUAze2mzHdhQ nGoVFsEi4w/W1wFV+L9XAulO8yTO5SXYcTb4bWqJrkZf4IBpe7bVmo1Xd7vPFfMo62Q6OwF3zUS llrje6UO5Omgb6Elyk0/3oh+DYaskduOou3Dh1O1zzxnbWsweYE5BtHwYwDtjPRSfRNzcGusm3N dLzbL2N88a4c9i3PbD1xFx+ubptqP/yuid03/3VdtUPa6tNSTskEUVL3V5YY1Ep2gNeToFphHl1 DgdeY2Oldor9/Uq9iLoEVs2BK4UJKphc60k/edEDCxLaIQP7WTQ== X-Google-Smtp-Source: AGHT+IHR0/H3ZR/Id9ULGDXwfYKVw+eMa54mCqI26W5/F4h2NzjpuoM9dXiRUGft23BOo5czHisrZA== X-Received: by 2002:a05:6000:1869:b0:391:952:c728 with SMTP id ffacd0b85a97d-39efba26158mr10140921f8f.4.1745322136875; Tue, 22 Apr 2025 04:42:16 -0700 (PDT) Received: from pro2 (p200300e0b7301900b98b74cfc94b2689.dip0.t-ipconnect.de. [2003:e0:b730:1900:b98b:74cf:c94b:2689]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39efa4a4c8fsm14690220f8f.89.2025.04.22.04.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Apr 2025 04:42:16 -0700 (PDT) From: =?utf-8?Q?Gerd_M=C3=B6llmann?= To: Eli Zaretskii Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck In-Reply-To: <86r01k2zrq.fsf@gnu.org> References: <86r01k2zrq.fsf@gnu.org> Date: Tue, 22 Apr 2025 13:42:15 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77942 Cc: eggert@cs.ucla.edu, monnier@iro.umontreal.ca, 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> Cc: Paul Eggert , 77942@debbugs.gnu.org >> From: Gerd M=C3=B6llmann >> Date: Tue, 22 Apr 2025 05:48:14 +0200 >>=20 >> But honestly, what the heck? Does someone know what this diffing is >> about in the first place? > > It's about leaving the unchanged portions of text intact, including > their properties, overlays, markers, etc. I believe the doc string > says that much. What I meant is why perform an O(ND) diff for that purpose. That's not at all obvious. (And it would be nice if the doc string talked about that O(ND) a bit to warn users.) From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 22 07:44:05 2025 Received: (at 77942) by debbugs.gnu.org; 22 Apr 2025 11:44:05 +0000 Received: from localhost ([127.0.0.1]:46543 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u7C2l-0006Gu-N6 for submit@debbugs.gnu.org; Tue, 22 Apr 2025 07:44:05 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:58543) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1u7C2h-0006FC-EP for 77942@debbugs.gnu.org; Tue, 22 Apr 2025 07:44:00 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-39c1ef4acf2so3112326f8f.0 for <77942@debbugs.gnu.org>; Tue, 22 Apr 2025 04:43:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745322233; x=1745927033; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4hzAna1AYPRyzJtxpMkizty2isp31gcoNEYJPvch760=; b=fgAkSKGgd04WlQSOkzzBd3miBHF/yXurr3fUvKA8+uPLbxflJHzp/d+fQm14g2/WUg grEqLlpNvVKDxlyZ/tNMnjEdg/o9Y7eif5AUdMsTUdWIzZRrvxpXnUddn2zYMFxbP2dp c/9AuWLWpc0TdXG2foInzby+HSPMnEWsjn0kcIRcnpfPW2Sf8rOtHRTwl6pr2GJ6kksP naIt2YEoVxuQ1SSbPK6daRHRWmXLcWR2DerND0HpHKcHAm2UR+w8+uDPZJuSQ6Qvskci 0OkmYI6AOelsn84b9bSEfsOUJyvC0xmx4oNUrFRZof958HCASAq3hoGLARxF2LBY+aSR knFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745322233; x=1745927033; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=4hzAna1AYPRyzJtxpMkizty2isp31gcoNEYJPvch760=; b=glvF+yq61vG9ll9+WOd8/5OvR3x2AdZr/1G1ejt/1s9c15slPwdgYBKyk72gPATD6Y 16OX+/6C0P1RxCCCmo4SP2c8jeQXIMRBuaFHNmpoNhbW7aqRdIdJ7adRjdleVuQFr8aI tx1XnMeyAdgIpazvKoOVXZoHAAFzO6Ef8U1WDyuDJjj151dgC511uNiuqpZIoMAA8Q2U uRBsZqE32987w6kZFA/NXhRcg9lXlpxF1RA7poUnw3tMxxHYIFb2mRBvCZP4rBzuqd8i L1w1Fwt1IfiIk2dZtC/UkBI5JTdFG8N/otNIjiqOE08VKwB1Gw9uUbSJ5dqmUYMnktYt sHEw== X-Forwarded-Encrypted: i=1; AJvYcCUzbFYs/WdCSeRD035ggWFrE9CQk+s/gCLEKyOFyYoHhcgL2nX65PCGQwbM+InIrwWoPsYKGw==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yz0JvWgJNTODweh/7OvN5yTvogTvvxg76I6oPpuAAnZFjvBe+ND xxNtqf7gjr1wyMAZ7jpPfOe8vq0BXvYzqHuqh2WvwG3iqfgyvduyZ+ysWA== X-Gm-Gg: ASbGncvEMS7XTMbn4wFqdM0a9sJK6mM8LRtPEz3zxakrE+PA5okF+lqujN8Eo2jTyN1 d4iM+IhdYNWrCeOk3hKyLN4ED0rokD85VOdF8+3JhnGhlwlJlg3+B+tjzq+CO2x/RiZHypeiFXi tG34TYyKD+E2qvg7Isr6hX5wVecBxV5MF2H+I74BR3NKGP6zLX8mh4xWcN6sg3ryyq2w2BYMEj/ Y50QFtnTffLHK43ggrAdTjPv/+gWLWOREyoLcyiXoj8nL3NYJQTY9ZlnOUKgtHWcZPev8ZrFAgQ hSUc/UBjkmZerhzoXzwYFn6NLAK3ULjiSS/MR/XR4yvkiVWYpZi/j5cf+ScdhKa0Uk03/Su7d12 pRhugAkyA5hke2GZ984GoQEGHC/aFjsmP4Y61zhoZyHbKzFSRhg== X-Google-Smtp-Source: AGHT+IHDChI8aaOL2/pxCz7liNy8x8HSq1Se6WdHQ8WIrFAayzVkwcVBLzdbQtXhSrh4KRXGPewLng== X-Received: by 2002:a05:6000:1448:b0:391:2db0:2961 with SMTP id ffacd0b85a97d-39efbace3d7mr12277487f8f.38.1745322232877; Tue, 22 Apr 2025 04:43:52 -0700 (PDT) Received: from pro2 (p200300e0b7301900b98b74cfc94b2689.dip0.t-ipconnect.de. [2003:e0:b730:1900:b98b:74cf:c94b:2689]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39efa4207afsm15147654f8f.12.2025.04.22.04.43.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Apr 2025 04:43:52 -0700 (PDT) From: =?utf-8?Q?Gerd_M=C3=B6llmann?= To: Eli Zaretskii Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck In-Reply-To: <86sem02zw9.fsf@gnu.org> References: <86sem02zw9.fsf@gnu.org> Date: Tue, 22 Apr 2025 13:43:51 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77942 Cc: monnier@iro.umontreal.ca, 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> Cc: 77942@debbugs.gnu.org >> From: Gerd M=C3=B6llmann >> Date: Mon, 21 Apr 2025 22:39:39 +0200 >>=20 >> Just found that replace-region-contents apparently uses a diff >> algorithm from diffseq.h, and that says >>=20 >> The basic algorithm is described in: >> "An O(ND) Difference Algorithm and its Variations", Eugene W. Myers, >> Algorithmica Vol. 1, 1986, pp. 251-266, >>=20 >> If N is the buffer size and D is the diff size, and both are large, good >> luck with that. And indeed, reducing the buffer size by 2 orders of >> magnitude makes things acceptable for my use case. > > You should be able to cut your losses by passing a sufficiently small > number for MAX-SEC, perhaps even zero. MAX-SECS isn't working as expected said Stef elsewhere. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 22 09:06:10 2025 Received: (at 77942) by debbugs.gnu.org; 22 Apr 2025 13:06:11 +0000 Received: from localhost ([127.0.0.1]:46794 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u7DKE-0001ts-Ie for submit@debbugs.gnu.org; Tue, 22 Apr 2025 09:06:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58750) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u7DK8-0001tB-Vn for 77942@debbugs.gnu.org; Tue, 22 Apr 2025 09:06:08 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u7DK2-0000gP-D0; Tue, 22 Apr 2025 09:05:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=8WTavpGG15NPWRulQF9gGUhey9rdFDnDns8OUfmCRck=; b=ovIwEb/ptqPzfPwWZOj5 O4eJOKom1nNAGfyCKZaBI3a8jTkvy65igNfwX6TZjBBn7mH+XtLOijRN21gX50gXrb7Z9BTUPFhD6 E8DSki8PSSijZ3c5Ob8vkMSk7Vo/QAenJqj/6mc0/C0fJSVDLC0uO1k90WtwEOzZIUKuE8GerMlV4 0xM14Ckjy6VwJKy9affpBC6MC7B76+NX9bCY01ngO6d2NAPCiFMzZlaBI7rqNfE+jKXREEdFV021Y rszVqBmSxCk319OURuy7wY9zWlEKMVDE5NDORsEZJKETxmO9/hDmneFQfq7CCAVqXOhxUgxmxomeR 4YD+vSKxG+k8GQ==; Date: Tue, 22 Apr 2025 16:05:53 +0300 Message-Id: <86ecxk2vny.fsf@gnu.org> From: Eli Zaretskii To: Gerd =?utf-8?Q?M=C3=B6llmann?= In-Reply-To: (message from Gerd =?utf-8?Q?M?= =?utf-8?Q?=C3=B6llmann?= on Tue, 22 Apr 2025 13:42:15 +0200) Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck References: <86r01k2zrq.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77942 Cc: eggert@cs.ucla.edu, monnier@iro.umontreal.ca, 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Gerd Möllmann > Cc: monnier@iro.umontreal.ca, eggert@cs.ucla.edu, 77942@debbugs.gnu.org > Date: Tue, 22 Apr 2025 13:42:15 +0200 > > Eli Zaretskii writes: > > >> Cc: Paul Eggert , 77942@debbugs.gnu.org > >> From: Gerd Möllmann > >> Date: Tue, 22 Apr 2025 05:48:14 +0200 > >> > >> But honestly, what the heck? Does someone know what this diffing is > >> about in the first place? > > > > It's about leaving the unchanged portions of text intact, including > > their properties, overlays, markers, etc. I believe the doc string > > says that much. > > What I meant is why perform an O(ND) diff for that purpose. That's not > at all obvious. AFAIU, it's because the Diff algorithm makes the minimum number of changes. > (And it would be nice if the doc string talked about > that O(ND) a bit to warn users.) It does: Because this function can be very slow if there is a large number of differences between the two buffers, there are two optional arguments mitigating this issue. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 22 09:06:52 2025 Received: (at 77942) by debbugs.gnu.org; 22 Apr 2025 13:06:53 +0000 Received: from localhost ([127.0.0.1]:46798 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u7DKu-0001v4-Ix for submit@debbugs.gnu.org; Tue, 22 Apr 2025 09:06:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53328) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u7DKs-0001uo-0Z for 77942@debbugs.gnu.org; Tue, 22 Apr 2025 09:06:50 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u7DKm-0000jY-Lj; Tue, 22 Apr 2025 09:06:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=Eg+cd0g69OOyNiaEyw/TSBFTKrowHcWVY73AKM4x6bw=; b=KvtgvUqoj6qFc1Rd7CRs LCAeEuBTc2CPc1+kGSZG1YUriUTBMV8iFQVaYXw2MoWdYPtUn6TQ7JKhYLZtsBB2j2k5Za1pbTD9f fS3FO4h4oJji2KJy++JU18AQCss+JGYiVANDX1l1DVDIVGRLBzl/NVPw7HeDR2VQHvdqu/BAlvkUJ SFgMhH8o1I0ClL/Em7Vql+uIH9B2pLRKsfO7zfgZ8bDUc9++KA7THqQY1TuHMx9ruxxZxPclKme3Q xJl/Y1nf7HhAOjIMNuSWTGw4NWdowKhCUtYAZddB4sqxs3xmgwhcXESOl6tO/0Q8cAX/TA+QsvmgX pKEdKMhlNR/sqA==; Date: Tue, 22 Apr 2025 16:06:34 +0300 Message-Id: <86cyd42vmt.fsf@gnu.org> From: Eli Zaretskii To: Gerd =?utf-8?Q?M=C3=B6llmann?= In-Reply-To: (message from Gerd =?utf-8?Q?M?= =?utf-8?Q?=C3=B6llmann?= on Tue, 22 Apr 2025 13:43:51 +0200) Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck References: <86sem02zw9.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77942 Cc: monnier@iro.umontreal.ca, 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Gerd Möllmann > Cc: monnier@iro.umontreal.ca, 77942@debbugs.gnu.org > Date: Tue, 22 Apr 2025 13:43:51 +0200 > > Eli Zaretskii writes: > > >> Cc: 77942@debbugs.gnu.org > >> From: Gerd Möllmann > >> Date: Mon, 21 Apr 2025 22:39:39 +0200 > >> > >> Just found that replace-region-contents apparently uses a diff > >> algorithm from diffseq.h, and that says > >> > >> The basic algorithm is described in: > >> "An O(ND) Difference Algorithm and its Variations", Eugene W. Myers, > >> Algorithmica Vol. 1, 1986, pp. 251-266, > >> > >> If N is the buffer size and D is the diff size, and both are large, good > >> luck with that. And indeed, reducing the buffer size by 2 orders of > >> magnitude makes things acceptable for my use case. > > > > You should be able to cut your losses by passing a sufficiently small > > number for MAX-SEC, perhaps even zero. > > MAX-SECS isn't working as expected said Stef elsewhere. If you set it to zero, it must work as expected. If it doesn't, it's a bug. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 22 09:14:18 2025 Received: (at 77942) by debbugs.gnu.org; 22 Apr 2025 13:14:19 +0000 Received: from localhost ([127.0.0.1]:46816 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u7DS6-0002E4-Hk for submit@debbugs.gnu.org; Tue, 22 Apr 2025 09:14:18 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:45546) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1u7DS3-0002Dl-5e for 77942@debbugs.gnu.org; Tue, 22 Apr 2025 09:14:16 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-39ee651e419so2910458f8f.3 for <77942@debbugs.gnu.org>; Tue, 22 Apr 2025 06:14:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745327648; x=1745932448; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+GtzAH7AzxqkjT/cPYmxgiZGwGxRgftqVnFGS6IqDWM=; b=RE2ONh3aVNy3DVpj2iLRJDln0YCnISMs1mf/A37N1K3kan40qCLbsPplaSmZzY8qhw dkfL/VSIkzWnRX2QRN1xlK5nIcwxS/B+szbAp0BoOiVi49doVV65X86Eq4mfWm2kTOQb 5GAZDNOvc/RAyim5P/EbbLdfgrd5eBxPGtJMXnmldorNxdOgr16sd5oHxlYzdL4rdmRy 09NQkZiBTpp/1Dq7CT+5qOMAIkhboawhkRsTg74UCtK8pcgwOHK+It1oNuiHMgY6ZjgA XrKxS3m9UXmCtEEEwkK0MES9/RyXPH9KOMq1bc0a2U+D+X40ohZbDS127+HmXQow0sIZ blVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745327648; x=1745932448; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=+GtzAH7AzxqkjT/cPYmxgiZGwGxRgftqVnFGS6IqDWM=; b=heoiu0SDThMM9e7vooWyM5z2U9M2kSTWBBq9C/gf5TilBO7e082VDpLICBlmSoh5Y3 xUsp0Ooa2q6SG11qzN9WqeNwUYfRL3Bnl47c88jStpIA15Un4JNYmrsdQIE50evwu971 ng5mlDOzvIw7SpXGT7m20RyHiUPVZ0pJtQd4VwaIhv4YDcfLKtQs5YM/Z0Dyeaqa9mKP W2IO4VLiZ4x+2/UYDGCY0qW/4EfJS05HOC5jxjHAdUpew55TrJJdZqmnqg9RbNQQz94I ZQfxFbgQ5iZ5p95gcaD/FNfSG8NQlyfUA5xH9f56mJaTenZu+YEI1/gkCW9eKKT1DX96 mZUg== X-Forwarded-Encrypted: i=1; AJvYcCUwBu00aaGf6JdwlBkUP+xL13j8s2JrDeQzitagrq1ZFXqPED6c1qRYf1fEA38GcsNjX2+Zew==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yznqe6VeXiL/uHq30YHSFgWBDYm8Sxv2pX0u5qlA7RDdwtMaDeB 1wE5fd+0i5Sj7+Dr6a4w7aTSqC4I8VUXdmjksjj+XhH+Y5fn2ppl1it41zHH X-Gm-Gg: ASbGncsK9Vl7tmt8SRgK+krfYRBhO+CMhaxYXgQKbYBH1LIz7byo7mYopDeeUqpEkog 0QuZSt6Qk+KAkh8WwSLYe8KJjhq/1ori7Sn5yuooKvFzNSA4QNjnlD34VZnrKzPd4Ai5VWhM+x3 ZYrloK/a6aY5NIDyhKIiEnS5ihwXk/LT+yr+nIXIiPiFizTDKXPfzPNgb5iclwKuXrI8Zy56i5o fvLBJe56E2UPiDbgdz8eccJKhIpYjIV7iq544jOMErg5TOvD2TObGxSKcxZD+QeMcNCF0FlL+pe b6lQ9wR7QDDX4w6JnybcAUS/hk9hgYCKEMXbMI2BPbaTL4rGxTpu/edBGj6BEZrITWll9F7FZFR FFO12f0EMEzLDHp4Ljk7mTBlyQPumq0jE40W9//ceUWI9 X-Google-Smtp-Source: AGHT+IHi6CTGPyp+FoSIlADOpkfu0mRiqxayHze7d9CptY7KRkSnpCa80ry+VlRjd3CP+Qy2GY8dTQ== X-Received: by 2002:a05:6000:40dc:b0:39e:cbca:922f with SMTP id ffacd0b85a97d-39efba3655cmr10371257f8f.12.1745327648471; Tue, 22 Apr 2025 06:14:08 -0700 (PDT) Received: from pro2 (p200300e0b7301900b98b74cfc94b2689.dip0.t-ipconnect.de. [2003:e0:b730:1900:b98b:74cf:c94b:2689]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4406d5acce9sm175198705e9.13.2025.04.22.06.14.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Apr 2025 06:14:08 -0700 (PDT) From: =?utf-8?Q?Gerd_M=C3=B6llmann?= To: Eli Zaretskii Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck In-Reply-To: <86ecxk2vny.fsf@gnu.org> References: <86r01k2zrq.fsf@gnu.org> <86ecxk2vny.fsf@gnu.org> Date: Tue, 22 Apr 2025 15:14:07 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77942 Cc: eggert@cs.ucla.edu, monnier@iro.umontreal.ca, 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Gerd M=C3=B6llmann >> Cc: monnier@iro.umontreal.ca, eggert@cs.ucla.edu, 77942@debbugs.gnu.org >> Date: Tue, 22 Apr 2025 13:42:15 +0200 >>=20 >> Eli Zaretskii writes: >>=20 >> >> Cc: Paul Eggert , 77942@debbugs.gnu.org >> >> From: Gerd M=C3=B6llmann >> >> Date: Tue, 22 Apr 2025 05:48:14 +0200 >> >>=20 >> >> But honestly, what the heck? Does someone know what this diffing is >> >> about in the first place? >> > >> > It's about leaving the unchanged portions of text intact, including >> > their properties, overlays, markers, etc. I believe the doc string >> > says that much. >>=20 >> What I meant is why perform an O(ND) diff for that purpose. That's not >> at all obvious. > > AFAIU, it's because the Diff algorithm makes the minimum number of > changes. > >> (And it would be nice if the doc string talked about >> that O(ND) a bit to warn users.) > > It does: > > Because this function can be very slow if there is a large number of > differences between the two buffers, there are two optional arguments > mitigating this issue. I find that pretty vague. If it said something about the O(ND), one could figure out that that can be morally equivalent to O(N^2) which I would find a fair warning. But whatever. Funny function that one. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 22 09:26:35 2025 Received: (at 77942) by debbugs.gnu.org; 22 Apr 2025 13:26:35 +0000 Received: from localhost ([127.0.0.1]:46874 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u7Ddz-000318-EI for submit@debbugs.gnu.org; Tue, 22 Apr 2025 09:26:35 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:19287) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u7Ddw-00030q-VQ for 77942@debbugs.gnu.org; Tue, 22 Apr 2025 09:26:33 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 4D5BE100034; Tue, 22 Apr 2025 09:26:27 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1745328386; bh=t5rCk5+F+Z2M9n6SilRuWgWFLoxji19QX2sylbb2k6E=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=pGkgpm9LXrwpToIMNd28DD+QwHLxWdBum48LE9ENJrGaT67P0eutP2GF0y/yBhYpY b6WXa6C1augNsCPIEeqT+fcaIDihLs91eg32ajTzO0xz2V+fEA23GtEZUa7btzjzjF HYdKC7VMwcvo5o+NHWmH+VuoSMcsbf8d60cK/x0yfPGOziUOtogFCxMm7GxakfBmfU tf7qGjc7erD+qU+666yFzN4lUNChxHCmv6PIkb3iajjXYd8i+vtSkw6H+vZCx5L2cO wf71b4SMewhQUqoSLlZT89fcLI8eUbMSsLDZzpGBVg+M7lUhZZ/9Tj0krdoYE8aOG8 7pk2Jy3X1TwKA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 4E9E7100027; Tue, 22 Apr 2025 09:26:26 -0400 (EDT) Received: from pastel (104-195-208-18.cpe.teksavvy.com [104.195.208.18]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 22E88120572; Tue, 22 Apr 2025 09:26:26 -0400 (EDT) From: Stefan Monnier To: Gerd =?windows-1252?Q?M=F6llmann?= Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck In-Reply-To: Message-ID: References: Date: Tue, 22 Apr 2025 09:26:25 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.226 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77942 Cc: Paul Eggert , 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Gerd M=F6llmann [2025-04-22 05:48:14] wrote: > Stefan Monnier writes: >> Gerd, IIUC you're trying to use this to benchmark the charpos->bytepos >> code, in which case you should be better served by a call where the text >> and its replacement are of fairly similar size. > > That's right, it's for a bencnmark that helps me to get an impression if > avoiding the binary search in the charpos -> bytepos case is worth it. > Now that I know what replace-region-contents does, that's no problem. > > But honestly, what the heck? Does someone know what this diffing is > about in the first place? I mean, that replacing a region takes O(ND) is > not something that I would have thought possible.=20 That's why I wanted (well, still want) to have a `replace-region` that does just the plain/stupid/naive replacement, and then keep `replace-region-contents` as a separate function (ideally even renamed to something like `replace-region-slowly` or `replace-region-carefully`). One place where the diff's extra work is worthwhile is when you do reindent/prettyprint via an external process. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 22 09:33:24 2025 Received: (at 77942) by debbugs.gnu.org; 22 Apr 2025 13:33:24 +0000 Received: from localhost ([127.0.0.1]:46901 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u7DkZ-0003Jl-HX for submit@debbugs.gnu.org; Tue, 22 Apr 2025 09:33:24 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:44173) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1u7DkU-0003JP-FO for 77942@debbugs.gnu.org; Tue, 22 Apr 2025 09:33:20 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-43cf58eea0fso24779235e9.0 for <77942@debbugs.gnu.org>; Tue, 22 Apr 2025 06:33:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745328792; x=1745933592; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QlZ9QOidpOoZCLsLnv9FKF6MQKDmGIsigr2XMr1q12c=; b=LH7ql0dBEND3DQjK15Yl3SxDRlz5CBaFwElE8+xvcIIY64zJTlRivt1M+HktRtP8If 5XTbpXIW17fUJAy28P6EyOBm42SmWKmay8YIe9v/M2NfTZVMeJDag0Z6drMeN1S0enR/ FjvODma/BXDz30n26gQRu7LnbwzK5BRKIZ1Lrnl+PNdEiecoxCknFEL6n9ISbjvYzzzi MESx5ql2N84fnhDKv87KZBuZ+PpYJq7zzcapHIpza9EvHMDZ/LGGc9WZ0TmC552RxPDR VP+2K7NZXZ7cK3LuL8VzILj6HQCZNP2FKobWQBKWL7NbesbhQAwTfqANjZ+YGVirdgSW SxoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745328792; x=1745933592; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=QlZ9QOidpOoZCLsLnv9FKF6MQKDmGIsigr2XMr1q12c=; b=BjX1aRrfoiCP2luvKoRiFdXmuGCQAu9f8h8AGnJxMEegkcVGw7af1hiVTLxMkzz4y0 1Bo5Q6rKuBVJ9OVQZ084XIvoPtg0/l9nCroL0xnwIUtiKmmPBCcIFkLRKt/05p9sxu9B HgTluJVgd9diXb8V+8J6JM26xlNFl0VNdUE6C6ImRUJRK7cx2iCee+u7ra12tXn0bMw7 UItPMaEg+DrKFRW0DkaQnoopIHnHbWPRlrqn1K/OBvludImO/BkD6spg7gdq71SDI4EQ p0IdGRRGM3FKIWOU9rK3gNIKFYwmiml0ZMYjQFDA1cOBoMvEgEL94aLADqw+Tuw+5Z11 zJUg== X-Gm-Message-State: AOJu0YwW3XrG17TgV3KSCjw+QupmZoyoji71ID1x/iKFqmCL8Jwblogk f+AndV6M18k0xW8hsFYbKzFqoPxsE6Yk3jL1JJeWz561tv7Jl29J X-Gm-Gg: ASbGncuZbKOPtNV4BzX9A15XeRSaysUmeVWY3aTPofi3mtlN+tHCNMt9OF7/cq7Ntog UHfHcrqGkEKiKxEaS7VFsYRM+7ftaPRk2XuVKH4QljPcxZ9LFKOd2Nk6nyqNibRvAje4DzS2AwR blEin5cqtgmbXGPSjISupptk2bG3wegomYTTk2Q7uLEdE/iXfcmsKNMfwHTrR0eaYelKuh6wDOe +i6y5i6OL0MYcSmH0lPfVIk1uChzC9CZAs8C38SWWJyaiX3liYiTALzMIud5opCsNb2OhVw/CjU XWZAkkIxy87wsL9RjYHp1tJQk/B+PtnAj2670Ua721MrgQvN0Bu7UH5q+/We3UGAA/LizYaYt3c +PMv2/AvhInNCUUJTkkfruzCBBAF5xVfLuWLlqXHZWfmJ X-Google-Smtp-Source: AGHT+IHegoBTmXu+2ct4sP1DUYXOFx4orPO6Cl5unhcSGRy0Z4fiWYJVwX9yjs8A4rpS68Y8v3cGgw== X-Received: by 2002:a05:600c:3b0f:b0:43b:cc42:c54f with SMTP id 5b1f17b1804b1-4406ab9882fmr125561335e9.14.1745328791778; Tue, 22 Apr 2025 06:33:11 -0700 (PDT) Received: from pro2 (p200300e0b7301900b98b74cfc94b2689.dip0.t-ipconnect.de. [2003:e0:b730:1900:b98b:74cf:c94b:2689]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4406d5a9e0esm178905035e9.5.2025.04.22.06.33.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Apr 2025 06:33:11 -0700 (PDT) From: =?utf-8?Q?Gerd_M=C3=B6llmann?= To: Stefan Monnier Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck In-Reply-To: References: Date: Tue, 22 Apr 2025 15:33:10 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77942 Cc: Paul Eggert , 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Stefan Monnier writes: > Gerd M=C3=B6llmann [2025-04-22 05:48:14] wrote: >> Stefan Monnier writes: >>> Gerd, IIUC you're trying to use this to benchmark the charpos->bytepos >>> code, in which case you should be better served by a call where the text >>> and its replacement are of fairly similar size. >> >> That's right, it's for a bencnmark that helps me to get an impression if >> avoiding the binary search in the charpos -> bytepos case is worth it. >> Now that I know what replace-region-contents does, that's no problem. >> >> But honestly, what the heck? Does someone know what this diffing is >> about in the first place? I mean, that replacing a region takes O(ND) is >> not something that I would have thought possible.=20 > > That's why I wanted (well, still want) to have a `replace-region` that > does just the plain/stupid/naive replacement, and then keep > `replace-region-contents` as a separate function (ideally even renamed > to something like `replace-region-slowly` or > `replace-region-carefully`). 100% agreement. +ND > One place where the diff's extra work is worthwhile is when you do > reindent/prettyprint via an external process. Thanks.=20 From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 22 10:33:21 2025 Received: (at 77942) by debbugs.gnu.org; 22 Apr 2025 14:33:21 +0000 Received: from localhost ([127.0.0.1]:49203 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u7Egb-0006mw-G8 for submit@debbugs.gnu.org; Tue, 22 Apr 2025 10:33:21 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:55556) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u7EgW-0006mc-V5 for 77942@debbugs.gnu.org; Tue, 22 Apr 2025 10:33:18 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 7D255100034; Tue, 22 Apr 2025 10:33:11 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1745332390; bh=k9OS5ROrJWK7ts+K6d7Xk97OwswPBcGN5TKexEGWkoU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=gpPqbejUZV5QBFQTMMwIg36vXKSwJa7ioGhi4ixct1GOfqvzDzJVOS9Rx04MKITdH 9qTTnhmcnK3f/G7QwxzGe2nXlh4IfGKwEYS4Y0oFMmnikqYG20lWyx9vmW2T0BEPhk dsmZ95jb9Z5xSF7KDAjvd8N+vFonV45oZISUTOj/IKYc5CjP3UtOSceFiuh//b1C9E K2SQ3VoiCWbL7ECoXegTWeudiyz0QcN6caT5+Eer36G4OoyuVKwxNuFt+vCpWH6iaL sb9gKyQi+2wjhRP+CCR1jLVPiwh2WGQjReaCfcgWNiwV59LWKK0TG/K/ubS6LCIgNK gPvJovoqXaQUw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id C32CE100027; Tue, 22 Apr 2025 10:33:10 -0400 (EDT) Received: from pastel (104-195-208-18.cpe.teksavvy.com [104.195.208.18]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 990BA12065C; Tue, 22 Apr 2025 10:33:10 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck In-Reply-To: <86cyd42vmt.fsf@gnu.org> Message-ID: References: <86sem02zw9.fsf@gnu.org> <86cyd42vmt.fsf@gnu.org> Date: Tue, 22 Apr 2025 10:33:09 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.225 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77942 Cc: Gerd =?windows-1252?Q?M=F6llmann?= , 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> MAX-SECS isn't working as expected said Stef elsewhere. > If you set it to zero, it must work as expected. If it doesn't, it's > a bug. He does want to trigger the diff code, tho. The problem is that in his test case, the diff code consults checks for a timeout too infrequently (e.g. not at all for a whole hour). Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 22 10:42:52 2025 Received: (at 77942) by debbugs.gnu.org; 22 Apr 2025 14:42:52 +0000 Received: from localhost ([127.0.0.1]:49229 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u7Epn-0007Fe-Si for submit@debbugs.gnu.org; Tue, 22 Apr 2025 10:42:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44748) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u7Epi-0007FL-VS for 77942@debbugs.gnu.org; Tue, 22 Apr 2025 10:42:48 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u7Epc-0003eR-I3; Tue, 22 Apr 2025 10:42:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=vtGuJ8LKn4yXLnNVRv2uBFAQ0zJ31ObZZWNuB5o7xao=; b=P2Jj+onfnvposeuRnkz3 C73Ka79lafQznseSgO6zmzQ7akiRvmVV5c3MwUdpKd4z9B8FMM782ZMJX7uOHl78UDGgBoBYGkZQj hhP1QWHPQ+4drbV3Xn7OWRuk0QLCROFsE5InMGvkK0QCKZTe+mfqANCsOYTnnpzCRIFgrMT1tUlDI tPZUOFwtsBhVpeO4uqS+RLz4j5FEFFA+fSOFUVNhzHmPavukFVAx4vIDCCQcQLa0zAfZ6OrCLewRm Re0WVWraLKPxq5kbs8WSR4585YJkSdPi8mbr89/Z9SnYIL6E3IlKO8YBiasG7HWWjyS7hPWeIJWMR UfiG4CKx8G3ufw==; Date: Tue, 22 Apr 2025 17:42:35 +0300 Message-Id: <864iyg2r6s.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Tue, 22 Apr 2025 10:33:09 -0400) Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck References: <86sem02zw9.fsf@gnu.org> <86cyd42vmt.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77942 Cc: gerd.moellmann@gmail.com, 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: Gerd Mllmann , > 77942@debbugs.gnu.org > Date: Tue, 22 Apr 2025 10:33:09 -0400 > > >> MAX-SECS isn't working as expected said Stef elsewhere. > > If you set it to zero, it must work as expected. If it doesn't, it's > > a bug. > > He does want to trigger the diff code, tho. Why is that? From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 22 11:20:55 2025 Received: (at 77942) by debbugs.gnu.org; 22 Apr 2025 15:20:55 +0000 Received: from localhost ([127.0.0.1]:49381 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u7FQd-0000hF-Hn for submit@debbugs.gnu.org; Tue, 22 Apr 2025 11:20:55 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:41660) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u7FQa-0000go-MR for 77942@debbugs.gnu.org; Tue, 22 Apr 2025 11:20:54 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id E4050807B7; Tue, 22 Apr 2025 11:20:45 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1745335245; bh=XURF9oVK6VzTKUB46ULUZaxG6eNnA+AtCtPoyk+qUWc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=b9XvxtUQcazgrRhcjHHmZs1MyoF7nfrOZ07GmSRj/L4eXzWUnImeawwmy646Gw6LP UvRvLq7kq/wbbgDJ/9d7yMORHGfuOfeGmzAqFrjppuL5n0izJfGAbdjSVR5z/mH+q2 dJkV0FnhBBf4LjQ+3fNayCpTMuvcfnwHIgZa4hxYGj1W+4JAwv1ZDdGPY3sz6t1cex wLFTsuEcS/ijjvVu+in7VwPXb+JXA4gt/4ZAUUHy2nIAzx1K41NiuWuirY7EAw5tTs 6LbpsiYZ1Oi7U4mtNcywASEhqRIVu1qljKZAcgntnx/Yb9dOGWd82lMK1b9IkxklJ8 Yv5sZ6aiGxwbQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 3462D803EA; Tue, 22 Apr 2025 11:20:45 -0400 (EDT) Received: from pastel (104-195-208-18.cpe.teksavvy.com [104.195.208.18]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 07EDF12051F; Tue, 22 Apr 2025 11:20:45 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck In-Reply-To: <864iyg2r6s.fsf@gnu.org> Message-ID: References: <86sem02zw9.fsf@gnu.org> <86cyd42vmt.fsf@gnu.org> <864iyg2r6s.fsf@gnu.org> Date: Tue, 22 Apr 2025 11:20:44 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.064 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77942 Cc: gerd.moellmann@gmail.com, 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> >> MAX-SECS isn't working as expected said Stef elsewhere. >> > If you set it to zero, it must work as expected. If it doesn't, it's >> > a bug. >> He does want to trigger the diff code, tho. > Why is that? Because it's the diff code which does loads of conversions from charpos to bytepos. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 22 11:31:20 2025 Received: (at 77942) by debbugs.gnu.org; 22 Apr 2025 15:31:20 +0000 Received: from localhost ([127.0.0.1]:49440 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u7Fah-0001FY-Kn for submit@debbugs.gnu.org; Tue, 22 Apr 2025 11:31:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34606) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u7Fae-0001FG-ET for 77942@debbugs.gnu.org; Tue, 22 Apr 2025 11:31:17 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u7FaY-0001Vp-DM; Tue, 22 Apr 2025 11:31:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=y4kBg5N7ZMvZ03Os92jO1FUBFQ/AOVmjNukA0PNv4BE=; b=en9K8AnskKY0 6kgy2oNwR6ryN5CmOrEypfE8uD2SIbAcmFLK6LiYcnocljpJzUnMYvHsyQgom7BGaqsm7eCV7uTGr 8LfJpkUU+e9sIoL7OR1WmRXUx0zz7GBNcXJqm3SfLvn6tu67EQPVi4KMGVT1utoQQ08femV7cXAXQ YkggstAWBjADc/AitnfyB00NNz3PNhZfSazjQlqpIDQgKQpeoALzBynOdM9YdPsjJTUT4HqiLGr9b yo4dIjQOW1yKV9UZYvhnBvv8TGbtE45FLxrMO+k5GaD1IYEayrnCKcknAAbokMdmJUXGTvYVZ53sY 1XgbPeTwQm4kMOD0l933Mw==; Date: Tue, 22 Apr 2025 18:31:08 +0300 Message-Id: <86zfg81adf.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Tue, 22 Apr 2025 11:20:44 -0400) Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck References: <86sem02zw9.fsf@gnu.org> <86cyd42vmt.fsf@gnu.org> <864iyg2r6s.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77942 Cc: gerd.moellmann@gmail.com, 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: gerd.moellmann@gmail.com, 77942@debbugs.gnu.org > Date: Tue, 22 Apr 2025 11:20:44 -0400 > > >> >> MAX-SECS isn't working as expected said Stef elsewhere. > >> > If you set it to zero, it must work as expected. If it doesn't, it's > >> > a bug. > >> He does want to trigger the diff code, tho. > > Why is that? > > Because it's the diff code which does loads of conversions from charpos > to bytepos. But then waiting for a long time is actually what the doctor prescribed, as it collects a lot of statistics, no? From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 22 14:23:02 2025 Received: (at 77942) by debbugs.gnu.org; 22 Apr 2025 18:23:02 +0000 Received: from localhost ([127.0.0.1]:49815 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u7IGs-0000tJ-8m for submit@debbugs.gnu.org; Tue, 22 Apr 2025 14:23:02 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:25523) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u7IGp-0000sk-EJ for 77942@debbugs.gnu.org; Tue, 22 Apr 2025 14:23:00 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 221E0442588; Tue, 22 Apr 2025 14:22:53 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1745346172; bh=YXGSik3uXdvv6LB0fMtQFjlCE9ifi3Sc/tMzzZre4Og=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=RYIynNXkhj9+ruU0DESQJBDFJoVsODp3Tnq7suil8F//0iU3dHahIG4IOuMcjfLF/ dVWlu8kcAIY9231aYcHulv7L0GKRRXA2GWfuAl4pfzP5YZoQsoj/+I4RWzB+8NtTT4 RJK4UkVNkOkKtBI7jfJuhYhgmyZDxJMQuAZO/VfyfZEyS2askJEAwQRQVQ94e95Y3y +7xkEMT8xMXf4d871/cnC6BRKgaQLIHBJRChaTkZqVFHmEgPLpDOP2pggzBUDe2F8j mSpWwtCQIGJ/KCEuFnnBWb3qPvlNbTHI3qGaPa4zGnjsObrVCQiWJkjz5XG04HDKT8 5K10s/EvH6MqQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 3ADCD442580; Tue, 22 Apr 2025 14:22:52 -0400 (EDT) Received: from pastel (104-195-208-18.cpe.teksavvy.com [104.195.208.18]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1001E12009D; Tue, 22 Apr 2025 14:22:52 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#77942: 31.0.50; replace-region-contents gets stuck In-Reply-To: <86zfg81adf.fsf@gnu.org> Message-ID: References: <86sem02zw9.fsf@gnu.org> <86cyd42vmt.fsf@gnu.org> <864iyg2r6s.fsf@gnu.org> <86zfg81adf.fsf@gnu.org> Date: Tue, 22 Apr 2025 14:22:51 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.017 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77942 Cc: gerd.moellmann@gmail.com, 77942@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> >> >> MAX-SECS isn't working as expected said Stef elsewhere. >> >> > If you set it to zero, it must work as expected. If it doesn't, it's >> >> > a bug. >> >> He does want to trigger the diff code, tho. >> > Why is that? >> >> Because it's the diff code which does loads of conversions from charpos >> to bytepos. > > But then waiting for a long time is actually what the doctor > prescribed, as it collects a lot of statistics, no? It would be if that time was spent in Emacs's side of the code, but in that case it's all spent in `diffseq.h` without calling us back to look at the buffer (which is what triggers the charpos->bytepos conversions and lets us check the timeout as well). Stefan