Faster Pacman (Lightning Memory-Mapped Database Solution)

Pacman is one of the fastest linux package manager but it has one problem makes it slow and annoying and it’s the local package database
We talked about it here :backhand_index_pointing_down:

Im working on new pacman fork still alpha 12% on progress that nuke this problem
Entirely and replace it with Lightning Memory-Mapped Database file

[ pacman CLI ] 
      │
      ▼
[ libalpm public API ] 
      │
      ▼
[ be_local.c (Filesystem Driver) ]
      ├── /var/lib/pacman/local/
      │     ├── git-2.45.0-1/
      │     │     ├── desc      (Plain text file)
      │     │     ├── files     (Plain text file)
      │     │     └── depends   (Plain text file)
      │     ├── gcc-14.1.0-1/
      │     │     ├── desc
      │     │     └── ...
      │     └── [ Thousands of other package directories... ]
      │
      ▼
[ OS VFS / Disk Inode Traversal (High I/O Overhead) ]

Optimized new Memory-Mapped LMDB database

[ pacman++ CLI ] 
      │
      ▼
[ libalpm public API (C++20) ] 
      │
      ▼
[ be_local.cc (LMDB Storage Driver) ]
      │
      ▼
[ /var/lib/pacman/local.mdb (Single File Container) ]
      ├── B+Tree Root: Package Metadata Index
      ├── B+Tree Root: File Ownership Index (-Qo)
      └── B+Tree Root: Provides / Conflicts Index
      │
      ▼
[ OS Kernel mmap() / Page Cache (Zero-Copy RAM Pointers) ]
5 Likes

@Halano That was very useful thanks. As were the links in your post. Thanks, from a newbie still learning after some years!

4 Likes

I’m surprised that after all this time that one area of “inefficiency” has not been improved before now. Then again, the existing dpkg, apt and apt-get methods in Debian based systems, unless they’ve had significant modifications over the years can probably benefit from some efficiency improvements too. I can tell you that when the SUSE project revamped their tools with the zypper tool it really sped up and modernized their approach. All of the package managers probably need a bit of TLC on occasion; some do a better job of taking care of it routinely.

3 Likes

I’m gonna admits it other pms are getting better
dnf5 zypper and nix

Check how fast pacman LMDB works -Su 60% project completed

3 Likes

I’m wondering if the apt infrastructure could use a fresh revamp? As you indicate dnf5, zypper and nix have already improved their package managers; I can speak for both dnf5 and zypper that they’ve been nicely improved; I don’t have any experience with nix for comparison. Apt, apt-get, dpkg and synaptic are okay, but I’d be happy to see some performance improvements applied to them.

2 Likes