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

Previous Next

Package: sed;

Reported by: Norihiro Tanaka <noritnk <at> kcn.ne.jp>

Date: Fri, 5 Aug 2016 13:52:02 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
To: 24160 <at> debbugs.gnu.org
Subject: bug#24160: [PATCH 1/2] sed: cache results of mbrtowc for speed
Date: Fri, 05 Aug 2016 22:51:16 +0900
[Message part 1 (text/plain, inline)]
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
[0001-sed-cache-results-of-mbrtowc-for-speed.patch (text/plain, attachment)]

This bug report was last modified 8 years and 270 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.