linker: Speed up find_loaded_library_by_inode()
Rearrange the st_dev and st_ino checks to reduce the number of comparison needed. Test: Ran cameraserver on a Go device. Measured time spent in the linker and saw ~1% speed-up. Change-Id: I8e977ff37925eae3ba8348e7c4a01ce8af3b9b6d
This commit is contained in:
parent
44c29535cc
commit
3ec16be2bc
|
@ -1222,12 +1222,14 @@ static bool find_loaded_library_by_inode(android_namespace_t* ns,
|
|||
off64_t file_offset,
|
||||
bool search_linked_namespaces,
|
||||
soinfo** candidate) {
|
||||
if (file_stat.st_dev == 0 || file_stat.st_ino == 0) {
|
||||
*candidate = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
auto predicate = [&](soinfo* si) {
|
||||
return si->get_st_dev() != 0 &&
|
||||
si->get_st_ino() != 0 &&
|
||||
return si->get_st_ino() == file_stat.st_ino &&
|
||||
si->get_st_dev() == file_stat.st_dev &&
|
||||
si->get_st_ino() == file_stat.st_ino &&
|
||||
si->get_file_offset() == file_offset;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue