From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id D884022BC9 for ; Sun, 11 Feb 2024 05:51:24 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1707627084; b=aP0Qkp7fzy6VN9FWuH3As8t4pFMpmCV9Vgz95OIpJcgwb7HHrTtaOmv/A86gWShVRQMVNVcC3r P0SziVsJs9sNB2ddUD4MulkVxbBgKiHJTtGnIYzaSl0g+LOQPPx/TErgBNN1V4qBqhxZbIh0ki 7/A1nL3J+ihCJ/y5pjPjREanwJmO8HAJCTUwCbznwQfrHTjSEItv7udAvh9VJjCzBFunmO7Asc KYMvZ/qQ3rDekQxGodaHGUH0kNRSa7UEROFGCOWmciC2ZN8o/IN9EHYHFQxAReTWRT/yQhDZ6a VdQkpJTix60X2w7Cgr9m5CSAm/TC/Wr4AQDc6km9HUUURA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f175.google.com) smtp.remote-ip=209.85.208.175; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1707627084; bh=FAF1NIAB3Jt/M8axKi4E/8d2ZyYb4AuiJxBk/nsemio=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature:DKIM-Signature; b=iPYWQSnuRbRf9XTxGMuiVs3nrT8bXldu45DLHT7AkTQB+X5avccIBh2/r09+Hq7eEg00pUSCyE 6SY8XUMSj9+YUR9N0eZRm4/7oPTM0RPXCMu69hWKTtM2ZQwNK8E4MDfrdFerLGRbLdHBhtc4a+ zr2Fal1KzNteI74WTwzyTOupMxAN0+Q6TPLTkuV+SpdGANut7kxVE/bcW5Lq37crkoPNraK41K OWZ5OwVXS0hgyQd8lfaeI20mj02GiXyVm9DgeFg3se5Q4qOn3oAs8bsKahsBbIEMIFKwN8PYyc 94+ijU8yRViGQYQHJC7pGFkxGM4KM5k3TcKYz8yrEaPvlA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=FAF1NIAB3Jt/M8axKi4E/8d2ZyYb4AuiJxBk/nsemio=; b=eCIURwV+uF8+IosLzT7qq9RQJV 6KMlsQACMsoJEdIsnf8e8ByJb8Kq4aPDr32aUk2VVhSUrvXLi5rPlai8U3yPoKlf1nNks40WsVlXh 5QbydngiCkGVpu+oyq6zhoI1zzWCSRa6GnGHpM4KWlUzzMdvk8sVXOUJycCRf+zIxEOjNHQg8tR4g mkzvDWvM0MH9IVYelekIeRnzLjANZVMeYNM5AOtMoyvUnMXa3oMXSwqauzoehKJSiOJMMQcFmLiK0 HJ/ofraXav0H7fW1+UWpmMX66wGY0QttQbspUR/nHiQSw1DPxSH2v0Y8rwY5LZtb0+9h0G6QvEDjw E/XhjH+w==; Received: by zero.zsh.org with local id 1rZ1oK-00050v-LB; Sun, 11 Feb 2024 04:51:24 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f175.google.com) smtp.remote-ip=209.85.208.175; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-lj1-f175.google.com ([209.85.208.175]:46380) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rZ1mT-00042R-LT; Sun, 11 Feb 2024 04:49:30 +0000 Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2d0a96bad85so31762241fa.1 for ; Sat, 10 Feb 2024 20:49:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20230601.gappssmtp.com; s=20230601; t=1707626969; x=1708231769; darn=zsh.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=FAF1NIAB3Jt/M8axKi4E/8d2ZyYb4AuiJxBk/nsemio=; b=g76NllfhQ4kwuyVyxfM6unVtXbe69cyQwqpm2FODudWOictBiABuRE/uNnD/6HH4T7 1M5zbqP3bhAVp9w9yK4Z5KcRjsiscwbqUS+0kR3yqAjNt3nQ8CnJSnuaT1LP34bUtUOt C7XQoJhMKk4+kJE0VhPaZAOPpi/bPDRx7f+OzYnVRCWjKiRsvbUn19RzJRX4gAPKoTql 2FxWRbvV0XbvilMAZlFgzAyn0WvpDQkaB14Lioeu5jTe9dPboeKsWa+i85WJi7gCQ+C1 f5wUn/6dpOkuhdjYTpCC2EmFYn2lhHY23J1vFCnXIVpU+Ouk1syOi+3ZaA2PM9caTPUs RL8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707626969; x=1708231769; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FAF1NIAB3Jt/M8axKi4E/8d2ZyYb4AuiJxBk/nsemio=; b=CUyRo80wpxjGwkJ6MGboBDWWKyLuqTONcEJ5xwGMBis7XGddjyZ/NJJPqBIUC334Zt QeGBSaXyYnJdeY6bfODo5IOQAVN+fjk/m3guevsaiUGY9hgwSeKFCiSs2stUBgKR3NV2 jOi52G87NHnaVVoXit8kOAOCoO1dFeyVwdWmnKK3buZ2eSWXNKCB9dIqefh2bkpPDloY S4URbEgQbwcEJ/QACtnYFu/+a2KxFK+vaXOXX7B/Ym3OxG1pniAkS6LHI+9NmSpBTYf0 LGmkpEqJKNLg/5DAU45lwcJbUTBxLdOs14ZC1jTTOgXcgtPZRiaBXWDQ46HHHOTJcDxS TFIA== X-Gm-Message-State: AOJu0Yw/wZTCSn4tRBehBR0wERLpvXWp1d1gzqJZSOBuW/L8kWRnj+mZ ErTunCIGQ2loV8vyJIVeSt6VgFcAu6ziwzBkvFWfJb6FSZF9ZHJV7rRbbVkIBID0jcZJGSvbRiL UAcyG53rREL1CHOjD5eewzFmb7gOoQ/BEdd4pld8N+AyxZZnyKA== X-Google-Smtp-Source: AGHT+IGvFWnI0a2e7pdPNwHWNx3uzY0EpHUcoafBfTje4QQd5Kn9EVM061kskp4sYR/zbPhOl2P/77s7BIz2T7+dMhY= X-Received: by 2002:ac2:48a3:0:b0:511:6241:d43a with SMTP id u3-20020ac248a3000000b005116241d43amr2148944lfg.10.1707626968926; Sat, 10 Feb 2024 20:49:28 -0800 (PST) MIME-Version: 1.0 References: <205735b2-11e1-4b5e-baa2-7418753f591f@eastlink.ca> <20240210204803.2ogpi5h752uzwf6e@chazelas.org> In-Reply-To: From: Bart Schaefer Date: Sat, 10 Feb 2024 22:49:17 -0600 Message-ID: Subject: Re: Slurping a file (was: more spllitting travails) To: Zsh Users Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 29654 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On Sat, Feb 10, 2024 at 6:59=E2=80=AFPM Mikael Magnusson wrote: > > I believe one of the motivating factors for this function was speed, > and copying all the data an extra time probably doesn't help with > that. Where's the extra copy in Stephane's version? Roman's optimized version uses the (j::) as well, turns out it's faster at a certain file size to build up the array and then copy it with the join than it is to append to a string without using the array.