|
Boost : |
Subject: Re: [boost] [Booster] Or boost is useless for library developers
From: Lassi Tuura (lat_at_[hidden])
Date: 2010-05-20 16:00:02
Hi,
> All of those are, presumably, for different T's, right? Can that be counted as duplication? Not if the destructor code is dependent on T, which a delete would be (and is most of those functions).
No. There are different types, but the bulk of it is repetition across libraries. The more visible the type, the more copies. Something very common will get instantiated into 500 libraries, and even if it's 100 bytes each, or even just 10 bytes, it adds up quickly.
For example for any specific type ABC, boost::detail::sp_counted_impl_p<ABC>::~sp_counted_impl_p() is 15 bytes only, but we have 76 of them, so it's actually 1140 bytes in executable memory (only 15-byte version gets used), plus function alignment padding, plus unwind tables, plus symbol names, plus relocation tables, plus PLT entries, and on and on.
One way to look at it is templates in interface is not a good idea if you will build more than a handful of DSOs. If you have hundreds or thousands like we do, templated types tend to generate bloat at dramatic pace.
Now why would functions declared inline get emitted 15-byte out-of-line functions, well, there's tons of practical issues behind that. But all those bigger and smaller "practical issue" streams add up to 140 MB for us.
Regards,
Lassi
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk