From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: [External] : Passing buffers to function in elisp Date: Tue, 21 Feb 2023 23:21:47 +0000 Message-ID: References: <87mt56hg4e.fsf@iki.fi> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14053"; mail-complaints-to="usenet@ciao.gmane.io" To: Petteri Hintsanen , "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 00:22:31 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 1pUbxu-0003Rr-Vj for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 22 Feb 2023 00:22:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUbxR-0004Ds-Jq; Tue, 21 Feb 2023 18:22:01 -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 1pUbxO-0004DP-UE for help-gnu-emacs@gnu.org; Tue, 21 Feb 2023 18:21:59 -0500 Original-Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUbxL-0001jA-HW for help-gnu-emacs@gnu.org; Tue, 21 Feb 2023 18:21:58 -0500 Original-Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31LMiKe1027541; Tue, 21 Feb 2023 23:21:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2022-7-12; bh=w/Ya4brcvOA6+0jeMDKFJ9ESVLjbb8NU09Zw2nZ0kBA=; b=15K1ih5OD/XsuFq6iYP347dRbUqVnMdz8NLMTTkqfuUrP7Ycysey9RviLSxNpykE9NTU L5ir1CINH9lXkA3Khvcp4GM3R7OX6x71gdItqL7F0thZTiyasNyRLset0SKmd5s3ne5W p69dL82VlX3kNFGfxSC3tJVlg9JORfvf0kEE38g/z4s4o254+VMFcWcOEldONwFqzwxy uh6J2OMcXj2NLjtpWcNvntjznKxCyQZKkiGj1sWzQzP/YlogzoJHbDeo5D6aN0egi/5E EOBaFSJQgR3MEdUGrRjCTT4I4kbKBCicQBMMstceNyQnx3pp/qmD9MbkZGI1AX2yqQGl ow== Original-Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ntq7uej4w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Feb 2023 23:21:51 +0000 Original-Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 31LLFBAH023252; Tue, 21 Feb 2023 23:21:49 GMT Original-Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2044.outbound.protection.outlook.com [104.47.51.44]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ntn45vgb6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Feb 2023 23:21:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gxfDUA0e4MhYT8O2auxT3sfp/IOJD0OY83F2GiWN95qAPuAsRkhyc6+8f3mtiTvVNY4niIgnTVyQpBUkCSUfTERdCZ1xO2V/l5DEvoYvxx7HKv6gIBY1S2WKbgyIvkHBJIKQq5j6+4RwVsS9Nkw+/r2VtTglxrYQEC1cM0UA7xiNJn9hBimTPzwqInYDrlxyYKj2VSSbOgUCVR+CL+z2AFqTmyUETKscrqm9xvMtq6UNkHcjxu60AKZ0ZHi1UkPgvAzz+dlERso1hqi9I1OuPeKxu83TcTiDe2ZjtHVUVnB+XUfrX6xUNSDmLOCeTIw2PPoKfJ5YEzXJmPPBrwDpKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=w/Ya4brcvOA6+0jeMDKFJ9ESVLjbb8NU09Zw2nZ0kBA=; b=Y8p4Q7WeNoz7ADtTMYsLw6MfGExw09PauHN+z5PwyGtRhLTge1gp4G+4ahU94QwoBpK8dYar2JUqXrmKv3dtc37uKS37dFf4H9TpUik67j6JO7zyYDDT8pM11D8E0dOr8Yd+Foy8iyfVLnWWuSbB7gjV1G47Qqy0HCM++DIi+sn+f4SqqKqPz8MXuTUUbRFSa3rs+eoGnPBg6VSogecbe7wOCwhLfex1sHoBAd1jEkA1UkyykluWZ5p+N0JMUpz/CAPwa9kPL/N0FCQyzxpLvoKW6r1epJS2UGIVd9tIhSd35fu19CFE3u5NGi0FliRV4INhWmi/OXpRB/jbbM6K6g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w/Ya4brcvOA6+0jeMDKFJ9ESVLjbb8NU09Zw2nZ0kBA=; b=ui+xMS6an11BUOSdeztZEEApIXGI3Xibl7bkHTH2PbvTo+LWMKz86QsuX+/3Is1ZAkt7vhMGVfXgUaxBpigfLw9l0srbxPHtWLkqpvUa0id/f9BYa7a0YxudXy/l8tZXHUVnbmbniz5Q2WKsjzeYk3dCk3P7wkNA2TO0iw9ScdQ= Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19) by CH0PR10MB4891.namprd10.prod.outlook.com (2603:10b6:610:c1::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.18; Tue, 21 Feb 2023 23:21:48 +0000 Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::d353:3fb:94e4:18b9]) by SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::d353:3fb:94e4:18b9%8]) with mapi id 15.20.6134.017; Tue, 21 Feb 2023 23:21:48 +0000 Thread-Topic: [External] : Passing buffers to function in elisp Thread-Index: AQHZRjpSpJxf9CDGdUOFYebSHlEse67aCZpg In-Reply-To: <87mt56hg4e.fsf@iki.fi> Accept-Language: en-US Content-Language: en-US x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SJ0PR10MB5488:EE_|CH0PR10MB4891:EE_ x-ms-office365-filtering-correlation-id: 5c3372e6-a297-4be4-a759-08db1462679d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: m17yS1IfMVAWkwhsXJVirDppv8pwShX/17ei+UjYP8uzpbOkmrbkh6jBR5Q9HvcF49Ns4itdJZscp7dvPLuoPiSonuttpEDHwePc4psmIa4NW872evK0tYBD8nu5YTDT3G56aDcIihNEO1j1cqI00O+ZCvZqA71WVgHal5Gcb9uPo65h8Ye1cw5mvM4xENJB/4AJ0gTtiEkQjiEHXeS24Yjm03btvR+D+mjkwMQDijKP08N+wS7kpOWgdvV1GeYCmdEEUdyFZYHtbrg4FXs8k4GbPF06YM1bk4EEYEsirmIYpjLtKx6fSXyf3eAps8SHBLVhAQNxhTwrzKxAGsn8J8EYgcdhSE/slG5jRLUkLW1N6XzH4EQPKCPK3qzBamIu8QzbvUPuiXqeHg0nnKoA6i9s6xnnx/Qjzf/Ex9QBghAsE6hMR0N3vwCbmdus73+hhPvlzu7K8OefKz80oCBEGF+FFm9gyPHBm+P4EO+m2aW7iFUkMH+J7PMYtUD+n3B7V/io/AaefeIWyTCvoNp6JDU3IfkEh1DhzfQ48zHJXqFaT6hSJVb9FqVQ40LtuwFeMBDZJbn98xE98AQ1N2h3mQPfzGygHjc4MEM0Hku6lOV954eKzqnWl9haz+VvtS7yiQjnmuBhlyi/qzdk5IidMofobaUM1oIdLtk2KzysMkJyx4Ks8fcXTNheglmhIxr58JILEQaxBBFp39syeP8dNw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR10MB5488.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(39860400002)(396003)(376002)(346002)(136003)(366004)(451199018)(110136005)(8676002)(41300700001)(478600001)(55016003)(122000001)(9686003)(26005)(186003)(6506007)(66476007)(66556008)(66446008)(66946007)(64756008)(316002)(71200400001)(38070700005)(86362001)(7696005)(33656002)(2906002)(4744005)(76116006)(83380400001)(5660300002)(8936002)(38100700002)(52536014)(44832011); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?PbErxUF59i4uIahSK2F1lgVprM9qjh8vq37D8Q1SL0TCClR7KgV508hcM3pJ?= =?us-ascii?Q?uP7ZcFsF3Ggdf9UDE2vnZfQrhiwyiNcyEDm3LGqIqS4ecBnAdK7kWwkRwqAJ?= =?us-ascii?Q?mAocQeX37LoxGzob5V/lOmi26H5D/b/J02PGH6qvE2m5DYDm5rVBAAECDyVb?= =?us-ascii?Q?ILJL4wAmpQWyAKwHDDV61/lWR3iEXCRpyf/cePVO+lR0plUvv0XaPvYAH1Ri?= =?us-ascii?Q?rk4xDYS+3V63cyFw5rpG5WK5PBhR2O+4C2ie4H5h+S8QvZuFhrnjTMqVO1nk?= =?us-ascii?Q?hbY1baMoYXDtQCer1Dt5yaBFr/HW1kYWdIlApLFOjPP2FqccEIKdpJvWO1/L?= =?us-ascii?Q?PungtmINPQU0CvgGEwoXiB+NmJXD5KGwh21eDNUJMRUfGm8pCkwucHKF8pcJ?= =?us-ascii?Q?WMPTkIcBUB2Fvwt82soY/psUnViyIfqBgatYV000BeAI3MyHfG0zAQ7XTMNM?= =?us-ascii?Q?kAPdhScZrk29XOsqWAAtUU30ayP1Q1ig77cN8xY0Bw050kHKeJDcqiLQRUGV?= =?us-ascii?Q?XmxR8KDpmqJY7gcFNelr7V/qv+gmYh7H3U7grG1ajCRlkJixKNreFcwj6HJ1?= =?us-ascii?Q?wI0xIOdnljzW7wASP6fgp9VyLgE32Z6I8Kv786TvZN7lrF0ixwicWT6HFW3w?= =?us-ascii?Q?X6 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: jb0HcgVQoY5v+SnVu1OJzxDx/41s9QCwdnKl2ScOkzZayFIzf26+pLL5MO+j8Vv+qhiuchIuVO4yOFbuWGN8lYweHAZ+XLWsyIsaa8qgtDfGS2jmcknwVPLBXBYjx9CNJX4d27jv2n8HZw27b+liQ87h9gu4qMW7a7gbQ63m+Uwbky+nPJOySaVBrOwPJYs+dokqs5e+v13IxHIJzHVg+Amr6tYakgVpJ6hMTN7ImIBOJFwkL/KCz7bJ64xq6h8nby1/92tIE67MfFqIYEG1k3P/p3wBFdty6mhgdThX/mojHY9qq6KfpMHzN6C89Gob7vvEYvdmkHKFSgP7YE7B9f8nE9OPKBe6QiGtVC8QsHhu0eB28XCWOzr6r5RYveKobrIhnvyFeWMZ+1GeqgoX9YG0ishK0cHAo8iay0/NiRvSQA/VWi2GDjuf8flHT8nc5Xt4Pt/WCjwViPMIoRMnmAbgVEPNavR5yt5oVSVosRdOU8/GYQzS0n0xxFiNEQYiehUEv+Alg6MAS5L4wXMTv4xkdeIebwj3pxHPWJZXRtu9RCRTYqkaQjnhpA2ymeW1APrfX5I7lTWtoXsM8tyvWa19A1FS9ip2y8/Zuuoo3+zXaVelP+GXuY3NR3lNMnTdEvDxmunsWaETwwDhteGsJOeDRcGvyKAIjmUvJUhCHgus/iOI1IiQEz3La/dwh+iCstYSlZhVpLg4y7juJcWH3STJK0vB1ruI6iA50E0yzbv1WU 4fyeIGo0tRoVK+ZaYV8aMU3e3r5xy8U/m+cWJsNg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5488.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c3372e6-a297-4be4-a759-08db1462679d X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Feb 2023 23:21:48.0636 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: sQoMgAo4+xzmUWmJEMtmuKBPLkTb5idAKw2GpskWDqvrBNyTPCNwJwnO9FcBUjQPFqIsSuH7Od2R0UJnwCqnXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB4891 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-21_12,2023-02-20_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=728 phishscore=0 malwarescore=0 mlxscore=0 spamscore=0 adultscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302210200 X-Proofpoint-GUID: pEWz17CnD4w-PYabrgC5qw-OaifzOqLI X-Proofpoint-ORIG-GUID: pEWz17CnD4w-PYabrgC5qw-OaifzOqLI Received-SPF: pass client-ip=205.220.165.32; envelope-from=drew.adams@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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:142798 Archived-At: > 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)) 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 func= 2? What is it that you're really trying to do? Yes, if you start manipulating strings instead of buffer text you will pay = a performance penalty, in general.