Question: Why is pacman so fast?
One of the best things about Archlinux is the package manager pacman. I have used Arch for many years now and pacman is generally how I convince people it's worth looking into (if they don't already buy the Arch Way(TM)). How do explain how pacman was designed or built from a developer point of view as to why it feels so much more efficient than other package managers (is this even true or is it just perception)?
About this post
- Posted
- Archived
- Score
- 42 · 100% up
- Kind
- Text
- ID
- 1mo3kl
51 comments
Quite frankly - I don't see pacman being much faster (I even think it's a bit slow on HDD with cold cache).
I've used apt/dpkg for a while, and found it just as capable as pacman. Some small things I like more in one than in the other (pacman's option names aren't all that discoverable, while apt requires knowing multiple tools).
The one thing I can say about pacman that blows every other package manager out of the water is actually makepkg - just a simple bash script, with a few variables and three functions, all rather self-explanatory.
Overall, though, I use arch for a variety of reasons, and pacman isn't all that high on the list.
Package rollbacks that work are nice, however.
Looking at you, apt.
you could just combine pacman with btrfs and use btrfs for rollback
Pacman isn't really high on your list really? Having an easy way to remove orphaned packages, or walk the dependency tree ranks pretty highly for me.
Looking at you there Yum.
Pacman is by far the best package manager I've ever used. One of my favorite things about Arch. That and they don't modify their packages from upstream all that much.
apt-getdoes butaptitudedoesn’t.aptitude install,aptitude search, same tool.Because it does less than other package managers, and does the rest in a much simpler way.
APT runs a lot of checks and scripts for every package, especially the "triggers" that rebuilds [I have no idea what] all the time.
Yum is even worse in that case because it prepares a transaction, save everything, check the changes, apply. This is so it can revert everything exactly like if you didn't run it in case of errors.
And generally speaking, pacman also handles less packages. From my observations apt-get runs quite fast too, but what's a single package in Arch is like 50 packages in Debian so it ends up slower. That makes a huge dependency tree that takes long to calculate, same for reading the database to the point you can see it... 10%... 20%... 30%... when you run an apt command.
This is how I understand it.
This is a good point. Pacman tends to distribute packages piecewise instead of in little chunks.
I've read about yum transaction over btrfs, is it so for any FS ?
Because doing almost nothing takes almost no time at all. Other packages and package managers (like deb and apt) are way more complex and have tons more features.
I use deb apt and yum. Please elaborate on these features you speak of.
Pinning, automatic conflict resolution, forbidding versions, security vs version upgrade, unattended upgrades, more powerful search. These are a few examples of what I use. Then there's the other side of the problem, package maintaining automation, tools, features, etc. I packed just a few of both so I'm not really an expert but while pkgs are just an archive and a bash script debs are incredibly complex.
On my laptop, pacman is stupid slow the first time I run it. Takes about 20secs to respond first time it's run.
I imagine that's your hard drive coming out of sleep?
try pacman-cage , it does make a speedup.
my guess is that's because packages are simple, and have simple and small metadata.
I would add that pacman was even faster 2-3 years ago. Much faster. I don't know what happened and why Arch became slower.
Before it used to not verify package signatures, which isn't a fast operation.
I can say that on my system (an Intel Atom netbook with a real but not fast hdd) pacman has gotten slower in one way: I used to have my pacman databases in file-as-a-filesystem's (a single file of 200mb that has a ext filesystem inside that then gets mounted as a loopfile, like a cd image iso). And that made it bloody fast. Now for a while pacman uses .db files for this, instead of individual files for each package it's now one file for the whole database. And the official recommendation has become that it is "no longer necessary to put the pacman db into a filesystem-in-a-file loopfile".
On my netbook this means that assuredly each time i first use pacman after a reboot it's gonna take half a minute of caching the whole db file. That would be ok, but coupled with only 1gig of RAM and ram hungry applications like Firefox i regularly run out of RAM and linux starts swapping things around, and that means that effectively most of the time i use pacman, even for just a dead simple "pacman -Qi linux", it's going to cache the whole damn db again.
I'm full time on my Samsung Netbook and I do not have these probelms after a reboot. It very well may be a misconfiguration of your system/pacman. If it really is lack of RAM then get one. They cost about 10-15 bucks for 2GB. Well worth it if you really run into troubles with your RAM. ;)
To each his own... My ranger installation slowed massively down on my netbook with each update and I have no idea why. :/ So morale of the story is sometimes weird stuff happens. :)
Deleted before we saved it.
This seems like a good place to air irrational grievances against Arch Linux.
Deleted before we saved it.
feel better?
re: my reply above: I was making an off the cuff snarky remark that pacman's args aren't super obvious and that their speeds are neglibly different (in my anecdotal usage, like I said I've used ubuntu for many years and Arch for about 11 months now, but whatever, I got fucking downvoted for... telling the truth about that in a different reply).
then I made an even bigger joke of it by saying it doesn't matter because a week in any distro will get you acquainted enough that it doesn't matter.
Jesus. I love Arch and have no complaints. Shit, it's not like I couldn't use a wrapper or aliases or something. I just saw the other day there were for zsh as I was adding a new plugin. Could've added it but didn't.
See buddy, maybe, if you don't go looking for "airing irrational grievances" you won't find them.
Good god. Now I'm back off to my Arch machine to figure out why my btrfs drives are still wonky (see btrfs, not the arch part of that sentence before you go looking for grievances). Good night. Christ
Deleted before we saved it.
Deleted before we saved it.
I'm a developer haha. I was interested in the internals, specifically what pacman was doing differently than other inferior package managers.
Speaking of which, I maintained ubuntu servers at my previous job and the way debian packages are constructed are complete shit. I ended up building everything from source to maintain my sanity. To each his own I suppose.
Lol, it wasn't meant as an attack on you. My posts never go over terribly well here, haha.
I guess I didn't see any reason to think of pacman as terribly performant, didn't mean to discourage learning more about it though, sorry!
I wouldn't say others are inferior, but coming from Gentoo and Debian, I also thought pacman is blazing fast.
Pacman seems a bit simpler, and perhaps more unsafe in it's approach to applying changes (new packages), but really, how often does your pc crash exactly when transactions in pacman happen? It seems to have gained quite a bit of speed for the sligthly simpler design/feature set.
I much prefer how pacman handles versioning compared to other package managers, at least as someone who often ends up outside official package tree.
Why do you say it is no faster than apt-get. From my experience, pacman is faster in every respect. Have you tried both before?
Well I ran Ubuntu since it's second release and switched to Arch a year ago, so I like to think I'm giving them a fair shake.
I really didn't mean to piss in anyone's Post Toasties. I obviously love Arch or I wouldn't run it. I would presume that pacman and apt-get are equally fast --- aka, whatever difference there is is insignificant to me.