[OE-core] [PATCH 2/3] package.bbclass: use oe.path.realpath()

Enrico Scholz enrico.scholz at sigma-chemnitz.de
Tue Mar 12 19:10:38 UTC 2013


Richard Purdie <richard.purdie at linuxfoundation.org> writes:

>> > Have you any time to look into this performance regression?
>> 
>> Well, patch replaced a call to os.path.realpath() with a more accurate
>> variant honoring a sysroot. There must be more work be done to replace
>> things previously solved by the operating system with custom (python)
>> code.
>> 
>> I will try to write a C implementation of oe.path.realpath() but this
>> can take some time and I do not have an idea how to integrate it into
>> oe.
>
> The issue is not an interpreted language verses C, the problem is the
> shear number of syscalls. Each isdir() and islink() call means a stat
> call into the kernel.

With

    try:
-        is_dir = os.path.isdir(file)
+        if assume_dir:
+            is_dir = True
+        else:
+            is_dir = os.path.isdir(file)
    except:

in meta/lib/oe/path.py you should be able to reduce calls to isdir().

A

-                rtarget = oe.path.realpath(path, inst_root, True, assume_dir = True)
+                rtarget = oe.path.realpath(path, inst_root, False, assume_dir = True)

in package.bbclass seems to be save (pkgfiles[] is filled by os.walk() so
that locations should be already physical) and might improve performance
too.

But I do not have numbers how much you can save by these changes.


Enrico




More information about the Openembedded-core mailing list