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

Re: PATCH: Don't treat NUL as a combining character



On Sun, May 10, 2015 at 2:14 AM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> On May 10,  2:02am, Mikael Magnusson wrote:
> } Subject: Re: PATCH: Don't treat NUL as a combining character
> }
> } > -#define IS_COMBINING(wc)       (WCWIDTH(wc) == 0 && !iswcntrl(wc))
> } > +#define IS_COMBINING(wc)       (wc != 0 && WCWIDTH(wc) == 0 && !iswcntrl(wc))
> }
> } Instead of making this path ever so slightly slower by adding an extra
> } test that only matters a fraction of the time
>
> I think the test would be no slower (or at least faster than what you have
> there) if you just put the wc != 0 as the last branch of the && chain?
>
> } could we actually make it wc > 127 instead?
>
> I don't know the definitive answer to that, but it seems it should also go
> at the end.  We're really micro-optimizing here, though.

That's a good point, I put it first because checking value is much
faster than calling a function, but NUL is super rare which I didn't
consider at the time.

-- 
Mikael Magnusson



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