Re: [ACPI] ACPI mentioned on lwn.net/kernel

From: Alexander Viro (viro@math.psu.edu)
Date: Fri Jan 25 2002 - 23:33:44 EST


On Sat, 26 Jan 2002, Jamie Lokier wrote:

> I once wrote a Perl script that needed to know the current directory.
> It did:
>
> use POSIX 'getcwd'
> getcwd(...)
>
> After a few months, I was annoyed by the slowness of this script
> (compared with other scripts) and decided to try speeding it up. It
> turns out that the above two lines took about 0.25 of a second, and that
> was the dominant running time of the script.
>
> I replaced getcwd() with `/bin/pwd`. Lo! It took about 0.0075 second.
>
> Says very good things about Linux' fork, exec and mmap times, and about
> Glibc's dynamic loading time, I think.

Most likely it says very bad things about getcwd() implementation in Perl
compared to sys_getcwd() in the kernel. The latter just walks the chain
of dentries copying ->d_name.name into the buffer. The former... my guess
would be stat ".", open "..", readdir from it, stat every damn object in
there until you find one with the right ->st_ino, put its name as the
last component and repeat the whole thing until you reach root...

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Jan 31 2002 - 21:00:39 EST