Skip to content

AIX: bootstrap investigate efficient way of reading archive #133268

Closed
@mustartt

Description

@mustartt

Currently in the bootstrap we are reading the entire archive into memory inorder to read the members:

 fn is_aix_shared_archive(path: &Path) -> bool {
      // reading the entire file as &[u8] into memory seems excessive
      // look into either mmap it or use the &CacheReader
      let data = match fs::read(path) {
          Ok(data) => data,
          Err(_) => return false,
      };
      let file = match ArchiveFile::parse(&*data) {
          Ok(file) => file,
          Err(_) => return false,
      };
  
      file.members()
          .filter_map(Result::ok)
          .any(|entry| String::from_utf8_lossy(entry.name()).contains(".so"))
 }

Find an easy way to either memory map the file or something else. Because currently this can take up to a second or two to read the larger dylibs into memory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-cleanupCategory: PRs that clean code up or issues documenting cleanup.O-aixOS: Big Blue's Advanced Interactive eXecutive..T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions