Skip to content
  • Morgan Adamiec's avatar
    libalpm: add iterator interface for syncdb files · 2b4c0229
    Morgan Adamiec authored
    This commit adds an iterator interface for reading files from the
    syncdbs. Instead of using alpm_pkg_get_files(), you now get the files
    from the database using alpm_db_files_open(), you then use
    alpm_db_files_next() to iterate through the files for each package. If
    you want to actually load the files from that package you then use
    alpm_db_files_load().
    
    This means alpm_pkg_get_files() will always return empty for syncdbs,
    even on .files databases, however these functions still work on the
    localdb and loaded packages.
    
    This aproach is faster when dumping the entire file list but slower when
    searching for a specific package.
    
    The memory usage of pacman is drastically less. See below.
    
    build/pacman -Fl        0.55s user 0.01s system 99% cpu 0.556 total
    build/pacman -Fl pacman 0.46s user 0.01s system 99% cpu 0.472 total
    build/pacman -Fx pacman 2.88s user 0.09s system 99% cpu 2.965 total
    
    pacman -Fl              1.60s user 0.13s system 99% cpu 1.731 total
    pacman -Fl pacman       0.24s user 0.04s system 99% cpu 0.283 total
    pacman -Fx pacman       2.45s user 0.14s system 99% cpu 2.593 total
    
                             Peak Memory
    build/pacman -Fl         43.52MB
    build/pacman -Fl pacmam  11.292MB
    
    pacman -Fl               677.048MB
    pacman -Fl pacman        163.288MB
    2b4c0229