From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17143 invoked by alias); 18 Nov 2016 07:09:28 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39972 Received: (qmail 17678 invoked from network); 18 Nov 2016 07:09:28 -0000 X-Qmail-Scanner-Diagnostics: from new2-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.224):SA:0(-0.7/5.0):. Processed in 2.638226 secs); 18 Nov 2016 07:09:28 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: psprint@fastmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at spf.messagingengine.com designates 66.111.4.224 as permitted sender) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=HRMpgWCg0OxO0miy9vGV5XHbrM 0=; b=3I0GXDgSkbD4VuxA42ZIiRQivO3V5t/YzNXnGPDXkGSYinkmmx7ltiOHPb apgAj70zMw64wxY0Xp4ct3rml8yreUElB9bBxgX9W5RW8H2GmHFUii22wJfg/NUR G5Pu7j8Wt/cWOLQCG9T6jYrqkDivWXtRgIu3vbET7fYgNzl08= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=smtpout; bh=HR MpgWCg0OxO0miy9vGV5XHbrM0=; b=kShGDb38I/CIH2bktDaL4m7OtObvD+K5U/ kLGJ99y34QVOVrcRyBfyJTWTYcmrGI4GbRUoiX7c1Uifa3AvrU9j/UhKlq63DF1e N02LhQ6563c4EvdaYQuIxrCJsyLkOQ4cVxA2PSHI34O+nSXtALKvRAFmKj00vWKy 4DJt92ZQ8= X-ME-Sender: Message-Id: <1479452962.1316016.791840001.098168A4@webmail.messagingengine.com> From: Sebastian Gniazdowski To: zsh-workers@zsh.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-461bce03 Date: Thu, 17 Nov 2016 23:09:22 -0800 In-Reply-To: <1479449829.1305485.791811385.14DDFE28@webmail.messagingengine.com> References: <1479449829.1305485.791811385.14DDFE28@webmail.messagingengine.com> Subject: Re: Possible huge setarrvalue optimization More, the optimization would apparently allow doing the following: typeset -a arr max_size=100 arr[max_size]="" for (( i=1, i<=max_size, i ++ )); do arr[i]="some data" done I was haunted by current implementation when writing morphogenesis screen saver (https://asciinema.org/a/47242), it has arrays that represent coordinates on screen: https://github.com/psprint/zsh-morpho/blob/5b84d919b5bbb7183ae78635adb995ab4c3ee7da/zmorpho#L11-L15 I've had to use integer-indexed hashes instead of regular arrays, which were very slow. After the opt I will be able to test is-at-least 5.3 and use regular arrays, maybe even pre-allocated with the `max_size` solution. -- Sebastian Gniazdowski psprint@fastmail.com