From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: [External] : Passing buffers to function in elisp Date: Wed, 22 Feb 2023 06:35:07 +0100 Message-ID: References: <87mt56hg4e.fsf@iki.fi> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="r0uRw3bHuF4pfGmk" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7955"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 22 06:35:35 2023 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pUhmx-0001pY-EA for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 22 Feb 2023 06:35:35 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUhme-0000C2-SP; Wed, 22 Feb 2023 00:35:18 -0500 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 1pUhma-0000BC-TJ for help-gnu-emacs@gnu.org; Wed, 22 Feb 2023 00:35:12 -0500 Original-Received: from mail.tuxteam.de ([5.199.139.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUhmW-00053Q-PT for help-gnu-emacs@gnu.org; Wed, 22 Feb 2023 00:35:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:To:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=wXIswtZIDmYRzVq1LIrJ9vN2/Cc08kBFwcUcImWgOV4=; b=Df3TelZ1m2e4OXk5MZkimzTZIy 1P1m4XpjTKysE7hNnK3HqnMoCAq/OpsrjCayMYKQvCu1KLWeHAWAP/L+yQWGthuALI5XfnFKfYrHz QiWcLNc4wByQN+tKZ39eJ6OmtnUDZYfcGUvJ/A1HIrAwKzumAu2O8sMkGHgpSyysuk/5hU/Jjq7R+ DUWfmrIexJarQ/xvv2Jz461L7+S8lP2S32HQwjVq+2bW0Z5IYVSnS4bxaP+MNGHMbN3Finos3c3LU GoeM0+KFcqsXqT1vwn2wczJG50wjx3I8bcN0tG3k6yB/qNAmqcpr6a6KT7brgyXAO+He89AOwTZF2 s8vwXJlQ==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.94.2) (envelope-from ) id 1pUhmV-0006em-1g for help-gnu-emacs@gnu.org; Wed, 22 Feb 2023 06:35:07 +0100 Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:142808 Archived-At: --r0uRw3bHuF4pfGmk Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 21, 2023 at 11:21:47PM +0000, Drew Adams wrote: > > I'm reading some bytes into a temp buffer, like so: > >=20 > > (with-temp-buffer > > (set-buffer-multibyte nil) > > (insert-file-contents-literally filename nil 0 64000)) > >=20 > > then I pass these bytes to functions for processing, like this > >=20 > > (func1 (buffer-string)) > >=20 > > or sometimes just part of them > >=20 > > (func2 (substring (buffer-string) 100 200)) >=20 > Why aren't you passing the buffer itself to func1? > Why aren't you passing the buffer itself and the limits 100 and 200 to fu= nc2? >=20 > What is it that you're really trying to do? That's exactly the point, yes. > Yes, if you start manipulating strings instead of buffer text you will pa= y a performance penalty, in general. =2E..the question being whether it's worth it or not. Sometimes it is, sometimes it isn't :-) Cheers --=20 t --r0uRw3bHuF4pfGmk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCY/WpigAKCRAFyCz1etHa RpINAJ43KDDAD9pUOAGNNKpFbIrdmbopfQCfWjW2b/qZyeLFvqhGYWHxR3HkLX0= =qD8N -----END PGP SIGNATURE----- --r0uRw3bHuF4pfGmk--