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: Mon, 19 Sep 2016 11:32:20 +0900
[Message part 1 (text/plain, inline)]
On Fri, 05 Aug 2016 22:51:16 +0900
Norihiro Tanaka <noritnk <at> kcn.ne.jp> 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.
[0001-sed-use-cache-provided-by-localeinfo-for-mbrtowc-and.patch (text/plain, attachment)]

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

Previous Next


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