bug-sed
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24160: [PATCH 1/2] sed: cache results of mbrtowc for speed


From: Norihiro Tanaka
Subject: bug#24160: [PATCH 1/2] sed: cache results of mbrtowc for speed
Date: Mon, 19 Sep 2016 11:32:20 +0900

On Fri, 05 Aug 2016 22:51:16 +0900
Norihiro Tanaka <address@hidden> wrote:

> Hi,
> 
> We can speeds up sed by caching result of result mbrtowc() for single
> byte characters.  It is effective especially in non-UTF8 multibyte
> locales which is expensive calculatation.
> 
> $ yes $(printf %040d 0) | head -1000000 >k
> 
> Before:
> 
> $ time -p env LC_ALL=ja_JP.eucjp sed/sed -ne /a.b/p k
> real 1.93
> user 1.61
> sys 0.27
> 
> After patching
> 
> $ time -p env LC_ALL=ja_JP.eucjp sed/sed -ne /a.b/p k
> real 0.46
> user 0.42
> sys 0.03
> 
> Thanks,
> Norihiro

I rewrote the patch as using localeinfo in gnulib.

Attachment: 0001-sed-use-cache-provided-by-localeinfo-for-mbrtowc-and.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]