Package: grep
Version: 2.5.3~dfsg-3
Severity: normal
File: /bin/egrep
Tags: patch
I've been profiling egrep since it uses lots of CPU when logcheck does its
thing.
In dfa.c, top of function epsclosure, we have this (with oprofile sample
counts):
: MALLOC(visited, int, d->tindex);
48796 16.2440 : for (i = 0; i < d->tindex; ++i)
94442 31.4394 : visited[i] = 0;
Replacing the home-made memset() loop above with doing CALLOC instead we get:
: CALLOC(visited, int, d->tindex);
: // for (i = 0; i < d->tindex; ++i)
: // visited[i] = 0;
Zero samples. But obviously all that didn't just disappear. It went into
memset:
samples % image name app name symbol name
60474 22.3932 libc-2.6.1.so libc-2.6.1.so memset
So instead of taking 50% of the CPU time with MALLOC(), it takes 22% with
CALLOC().
Please change MALLOC() to CALLOC() and remove the loop.
Regards //Johan
-- System Information:
Debian Release: lenny/sid
APT prefers testing
APT policy: (990, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.22-2-686 (SMP w/2 CPU cores)
Locale: LANG=sv_SE.UTF-8, LC_CTYPE=sv_SE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages grep depends on:
ii libc6 2.6.1-1+b1 GNU C Library: Shared libraries
grep recommends no packages.
-- no debconf information
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]