Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Slow highlighting (Re: "drop-in replacement" and transpose-words-match)



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



Messages sorted by: Reverse Date, Date, Thread, Author