[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: New versions of openbsd_{basename,dirname}.c

On Tue, 2012-01-17 at 14:23 +0100, Samuel Thibault wrote:
> Svante Signell, le Tue 17 Jan 2012 12:37:53 +0100, a écrit :
> > On Tue, 2012-01-17 at 11:05 +0100, Samuel Thibault wrote:

> Why? "tar" is a performance-sensitive feature. I guess basename/dirname
> is used quite a lot there.

I propose to add code only for dirname.c

basename is only called in two functions:
1) main.c: progname = basename(argv[0]);
2) lib/handle.c:tar_{open,fdopen}():tar_init():path_hashfunc();
lib/util.c:path_hashfunc():p = basename(buf);

The dirname calls are all in lib/extract.c of the form: (7 functions)
if (mkdirhier(dirname(filename)) == -1)
so there optimization might be of use. Is it really worth the effort?

Reply to: