On 06/09/2014 02:14 PM, Eric Blake wrote: > On 06/08/2014 04:33 AM, Pádraig Brady wrote: >> On 06/07/2014 09:37 PM, Alex Deymo wrote: >>> Add the --enable-single-binary option to the configure file. When >>> enabled, this option builds a single binary file with all the >>> selected tools in it. Which tools gets executed depends on the value >>> of argv[0] which is intended to use together with symlinks to the >>> single program. >>> > >> >> This seems like a very useful option, thanks! >> Yes given that there are around 100 utils, >> amalgamation like this reduces overhead significantly. > > Isn't that precisely the premise of busybox?
Should we not support it if easy to add? > I'm also slightly worried about the ramifications. I was waiting for timing/assignment info before digging into the implementation, but yes there are significant things to consider here. > For example, sort is > currently multithreaded, and therefore must take care that use of stdio > functionality is properly locked between threads. Meanwhile, most other > utilities are single-threaded, and can optimize to use unlocked stdio > functions for speed because there is no other thread competing for > locks. But if combined into a single binary, then that one binary will > be multi-threaded, and you may lose the performance benefit of > specifically compiling other apps to be single-threaded. Note sort still uses the unlocked I/O functions. I was unsure about it, but on further investigation seems OK: http://lists.gnu.org/archive/html/coreutils/2013-11/msg00087.html There will be overhead associated with an amalgamation. For example all shared libs would be loaded and resolved even for simple programs like `true`. Also all static data initialized etc. It's worth noting that if all utils aren't needed then an option like provided by openwrt is to have separately installable utils: For e.g.: http://downloads.openwrt.org/backfire/10.03/brcm47xx/packages/ thanks, Pádraig.