bin/71367: regex multibyte support is really slow
Tim Robbins
tjr at freebsd.org
Sat Sep 4 03:50:27 PDT 2004
The following reply was made to PR bin/71367; it has been noted by GNATS.
From: Tim Robbins <tjr at freebsd.org>
To: Kuang-che Wu <kcwu at csie.org>
Cc: bug-followup at freebsd.org
Subject: Re: bin/71367: regex multibyte support is really slow
Date: Sat, 4 Sep 2004 20:49:07 +1000
On Sat, Sep 04, 2004 at 05:39:33PM +0800, Kuang-che Wu wrote:
> >How-To-Repeat:
> $ cc -O -pipe re.c -o re
> $ time ./re
> 7.65 real 7.51 user 0.06 sys
>
> #include <stdio.h>
> #include <locale.h>
> #include <regex.h>
>
> int main(void)
> {
> regex_t re;
> char string[1024]={
> #define WORD 0xe6,0x85,0xa2 /* UTF-8 character */
> WORD, WORD, WORD, WORD, WORD, WORD, WORD, WORD, WORD, WORD,
> WORD, WORD, WORD, WORD, WORD, WORD, WORD, WORD, WORD, WORD,
> 0
> };
>
> if(setlocale(LC_CTYPE,"zh_TW.UTF-8")==NULL)
> return 1;
>
> if(regcomp(&re,"[[:alnum:]]",REG_EXTENDED|REG_ICASE)!=0)
> return 2;
> if(regexec(&re,string,0,NULL,0)==0)
> printf("matched\n");
>
> return 0;
> }
I can't reproduce these results. I get:
$ gcc -O -pipe re.c -o re
$ time ./re
real 0m0.003s
user 0m0.000s
sys 0m0.002s
CPU: AMD Athlon(tm) 64 Processor 3000+ (2002.58-MHz K8-class CPU)
Do you have any non-standard options in /etc/make.conf? Have you changed
the C library at all locally? Can you confirm that the system you ran this
on was idle?
Tim
More information about the freebsd-bugs
mailing list