lkml.org 
[lkml]   [2002]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [ACPI] ACPI mentioned on lwn.net/kernel


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/

\
 
 \ /
  Last update: 2005-03-22 13:15    [W:0.701 / U:0.664 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site