From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Edebug corrupting point in buffers; we need buffer-point and set-buffer-point, perhaps. Date: Mon, 31 Oct 2022 20:09:08 +0200 Message-ID: <83iljzeugr.fsf@gnu.org> References: <83v8o0dtg3.fsf@gnu.org> <83pme8dp2r.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20311"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 31 19:11:56 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1opZGN-00054C-Im for ged-emacs-devel@m.gmane-mx.org; Mon, 31 Oct 2022 19:11:55 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opZFG-0002fU-Hg; Mon, 31 Oct 2022 14:10:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opZED-00020r-4I for emacs-devel@gnu.org; Mon, 31 Oct 2022 14:09:41 -0400 Original-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 1opZDz-00041f-DQ; Mon, 31 Oct 2022 14:09:30 -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=uqtK/2IPogcCIyt5BlFi1Q/v/QhYRgf8v39TA2CfJhs=; b=I557M1nxOCsh qSLAkR2YzaEGhId5xrDK9MZEcPX1dOpElHWLDlzScO7ao1552/Z5HuEZR8f5qzDB2GRyWVeJcV9hP YqO1dp0oyi9qYpSa1lpieQz0AGtBKyzeZ7ElMKbzurWu49dxgzNWe4MZXGXo1ozliPr64YsaboNpJ 1Bh79Gh5EFNzQonr8cdwiSzLhw/nYMgAb/ClKZ6AXNfrnu3hYWQKiLcONDD2G7WdDygCBqbpVCVrM 4aXMykIFPvbPfVgG2AaRd4BU+xc65/CKZ3/p9pG6gQCuhJ6YuLx7yhQp8Mq9nAETesGWHkVOem0yz uRrZ3enUW1yo9bH5EhMucg==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opZDw-0005z8-DA; Mon, 31 Oct 2022 14:09:26 -0400 In-Reply-To: (message from Stefan Monnier on Mon, 31 Oct 2022 13:19:34 -0400) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "Emacs-devel" Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:298883 Archived-At: > From: Stefan Monnier > Cc: Alan Mackenzie , emacs-devel@gnu.org > Date: Mon, 31 Oct 2022 13:19:34 -0400 > > >> + CHECK_FIXNUM_COERCE_MARKER (pos); > >> + p = XFIXNUM (pos); > > > > This is sub-optimal: a marker holds both character and byte position, > > and you lose it here. Ignoring the byte position is only justified if > > the marker belongs to the wrong buffer. > > I suspect the performance impact is negligible Are you talking about using character and byte position, or are you talking about something else? The performance impact of char_to_byte is not negligible at all! > compared to what it would > cost using `set-buffer`. Since we're not convinced the cost of > `set-buffer` is high enough to justify `set-buffer-point`, I wouldn't > worry about optimizing the case where the arg is a marker. My remarks were general, not necessarily related to this particular patch. The principle should always be if you already have a byte position, use it!