Thin archives reduce binary bloat by storing only file names instead of full file contents, since the linker needs the symbol index for efficient linking but doesn't require duplicate copies of object files that already exist on disk; this technique, invented in 2008, can save significant disk space (e.g., 20GB+ in large projects) without impacting link time, though it requires conversion for redistribution.
Approfondir
Prérequis
- Pas de données disponibles.
Prochaines étapes
- Pas de données disponibles.
Approfondir
Lightning Talk: Reducing Binary Bloat With Thin Archives - Florent Castelli - CppCon 2025Ajouté :
attending this conference definitely I [music] would say to get lot of insight who are already working in the industry they are already here a lot of trading firms [music] I am into finance so I met a lot of people who are already in finance and they gave me a lot of [music] insights [music] all right hi everyone uh I'm from I'm working at Angeflow. Me and my colleagues, we really like fast builds and we like to help you doing that. And today I'm going to teach you one trick uh that allows you to reduce the binary bloat uh with uh fin archives. So if you look at the compilation model for C++ in general, you take some source files, you compile them into object files. You take those object files, you merge them into static archives, and then you take some object files and static archives, you link them into binaries. That's the basic model. Um let's go dig into uh static archives because a lot of people don't know much about them. So what's stored in a Staric archive? Well, you have a copy of object files uh with some metadata and you also have a uh symbol index which is a list of all the exported symbols from all the object files in there which linker use to make things go fast. Um typically, um the archiver program you're going to use is going to be AR, Linux, Mac OS, BSDs or lib on Windows. And I show you some command line which is very simple ARQC output and then inputs that copies all the files in there. And then you can have another command called runib that uh you run on the archive and that adds the index to make things go fast. Um, so if you look at the build folder content for a few different projects, I took CMake and Clang both build in debug mode on Linux. You have CMake, which is uh several hundreds of megabytes and you have about 200 megabytes of objects and about the same amount of archives in there. For clang, you have a little bit over 20 gigabytes of objects and archive. And as I told you, uh, well, archives contain a copy of all the objects. it feels a little bit wasteful.
So, uh why do we use starter archives?
Well, start a solution to solve circular dependencies between interdependent object files because sometimes you uh the linker needs to go find a symbol and usually find the symbol on the things after in the command line. But if you have secret dependencies doesn't really work. So, you put things in archives.
Um, that's also a way that is way more convenient to link things. Putting one archive is better than hundreds of object files. Uh, it's good also for redistributing an archive for example to some clients consumer installing, but it's also a good way to waste disk space and disio. Wait, what? So, I'm going to teach you a way to reduce some of that binary bloat. Um, that's called F archives. um it's been invented in 2008, so it's quite old now. And instead of copying the files in there, you just copy the name of the file because the file is already on disk next to the static archive. So why do you need another copy of it? You still have in there the uh symbol index for linking because the linker needs that instead of opening hundreds of files. That is a lot more efficient. And the linkers just use in the same way is totally transparent.
You create a fin archive using a flag called d-fin or - t with other versions and you use it the same way but it's not good for distribution because well it's just the name of the file and not the content of the file. So if you look at some numbers, you'll see that for example in the case of clang uh instead of having a big portion uh of the build folder disc space being used by archives, you have less than half a percent and you're saving 20 gigabytes uh there. So it's pretty good saving. Um so what's the catch? Is it you impacting archiving times? Yes, positively because you do less work. So that's good. And um if you have a slow disk it will be faster most of the time it doesn't matter because we have fast disc but you never know is impacting link link time no as sad as ever. So um the only thing that matters is if you try to redistribute those doesn't work but then you can use some tools to convert them into regular archive and then they will just work as before. Um, we can to you could talk also that they're good way to merge archives together, but I don't have a lot of time, so I'm going to skip that. Uh, how to use that variables in CMake, for example, you add d-fin into all of those. It will work globally and, uh, that's a fine way. You have another way more modern with properties, static library options, d-fin, and it will just work on all the libraries you want. If you want it everywhere, uh, you'll need more work. It works on Linux uh since 2008, Mac OS and Windows if you have LDM tool chains. And that's it. Thank you.
[applause]
Vidéos Similaires
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 views•2026-05-28
How agent o11y differs from traditional o11y — Phil Hetzel, Braintrust
aiDotEngineer
450 views•2026-05-28
Re: 🗣️📍theprophedu📍2026 GST 103 CLASS (E-EXAM REVISION)
theprophedu
636 views•2026-06-04
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanation💯✅
LearnwithSahera
1K views•2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 views•2026-05-29
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 views•2026-05-30
Instagram accounts got PWNed
EricParker
13K views•2026-06-03











