From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10170 invoked by alias); 12 Feb 2016 09:41:49 -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: 37951 Received: (qmail 21275 invoked from network); 12 Feb 2016 09:41:47 -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=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=VLHfSk3MeYvrtvZmP1sIgJONR54UWeE33V2JygzEUz0=; b=jL/ztYOUXxZyeslIfrwONxJ0AT+7W/wboPfK0u4vSzRjVVRMVmoDW0qlisMqHgK8G+ 7bYQc9ooKAZCPz5cFk0MWM3nGeV3/NDubD/KpYG0b74skphJUA7DVi/v9U+lAhCBGARN rHaVF6OnakLfXkg1BkoAfyobvD1gnW4UzADlsX0JBySUVMFybgz1XIgP6nqO7L03G2nw EB8rDtcGrVFVlVc7+l39sdlCsPt+Dxkx8sJyE2fxbKltQ4pqWcjgXWklCC6GPGZ0t36/ P4oiuAee6aN1T0vShfpKt2ydSpoJor8mFVIjGeF8DFPyMtrjnutzQgidcDgzdIkd36Qe VDew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=VLHfSk3MeYvrtvZmP1sIgJONR54UWeE33V2JygzEUz0=; b=EGxiGvDflUNpNmbdEwc3OWd4lB38AKd3Q8vKCj063UESAcLF3KAfC4+7MMb3EQ+Vk6 nB1GxwcyZySX7aom7h5ENJf/ZbfwoIbHTvzAsqyHjfCkrVQ//RxJ8bUjS+9nWABsrpsS iBNSpOA7PJDvVNpwmL/oOOHcID2xL4yEjkhrypiUOTVbZCND2RteWQhyNscK1bDbxwJg LO3vDxnOKmmFgkA6M1NRdVzhitLvdTVmjFPzRVJTiv2R4+ieA7/7BeEWs17OI1WSHkF8 IgVyjunaADtCWVIQPIDNDpX6bRifzLfWfIStdNuuWg7gycBOwZdQWbPqDDG+VdvlicUb sMlA== X-Gm-Message-State: AG10YOTaXXy0rj/e3vSr3udS3Dm7UkrOfb+fk8q8fYYKw5LHBuKWQIrjZSymy/Brb57bNg== X-Received: by 10.67.23.161 with SMTP id ib1mr89888pad.156.1455270104277; Fri, 12 Feb 2016 01:41:44 -0800 (PST) From: Bart Schaefer Message-Id: <160212014148.ZM12746@torch.brasslantern.com> Date: Fri, 12 Feb 2016 01:41:48 -0800 In-Reply-To: Comments: In reply to Sebastian Gniazdowski "Re: Slow highlighting (Re: "drop-in replacement" and transpose-words-match)" (Feb 11, 11:43am) References: <160111233259.ZM6719@torch.brasslantern.com> <160118223126.ZM28565@torch.brasslantern.com> <160119195608.ZM31931@torch.brasslantern.com> <20160123235303.GE20278@tarsus.local2> <160123222057.ZM16192@torch.brasslantern.com> <160210101846.ZM2333@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh hackers list Subject: Re: Slow highlighting (Re: "drop-in replacement" and transpose-words-match) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Feb 11, 11:43am, Sebastian Gniazdowski wrote: } } The point of this tangent example is: every indexing works by } iterating over buffer and counting characters. That's only true for indexing from the end of the string (negative indices). Normal indexing should be direct and very fast. } By using ":5000" one pass of finding where an index points to is } skipped, as it says "5000 characters from now on". Index -1 iterates } from the beginning again to find end of string. True, but again only relevant if indexing right to left at the end of a subscript range. } The only solution is apparently making Zsh storing strings as real } arrays, of wint_t type. I'm not sure what kind of arrays you think are "real" as compared to what zsh uses now, but vast tracts of the shell would have to be entirely rewritten if we were to change the C string paradigm. } As for the (i), as far as I remember from the time I worked on C } source, reverse indexing uses one additional "iterate counting } characters" block: IIRC this is unavoidable given that we're counting characters vs. bytes. Perhaps that's what you mean by "only solution is wint_t", but I think that would be discarding a lot of other optimizations. -- Barton E. Schaefer