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: Fri, 05 Aug 2016 22:51:16 +0900

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

Attachment: 0001-sed-cache-results-of-mbrtowc-for-speed.patch
Description: Text document


reply via email to

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