几种C库比较(musl uClibc dietlibc glibc)

itopidea 2018-3-16 641

Bloat comparisonmusluClibcdietlibcglibc
Complete .a set426k500k120k2.0M ?
Complete .so set527k560k185k7.9M ?
Smallest static C program1.8k5k0.2k662k
Static hello (using printf)13k70k6k662k
Dynamic overhead (min. dirty)20k40k40k48k
Static overhead (min. dirty)8k12k8k28k
Static stdio overhead (min. dirty)8k24k16k36k
Configurable featuresetnoyesminimalminimal
Behavior on resource exhaustionmusluClibcdietlibcglibc
Thread-local storagereports failureabortsn/aaborts
SIGEV_THREAD timersno failuren/an/alost overruns
pthread_cancelno failureabortsn/aaborts
regcomp and regexecreports failurecrashesreports failurecrashes
fnmatchno failureunknownno failurereports failure
printf familyno failureno failureno failurereports failure
strtol familyno failureno failureno failureno failure
Performance comparisonmusluClibcdietlibcglibc
Tiny allocation & free0.0050.0040.0130.002
Big allocation & free0.0270.0180.0230.016
Allocation contention, local0.0480.1340.3930.041
Allocation contention, shared0.0500.1320.3940.062
Zero-fill (memset)0.0230.0480.0550.012
String length (strlen)0.0810.0980.1610.048
Byte search (strchr)0.1420.2430.1980.028
Substring (strstr)0.0571.2731.0300.088
Thread creation/joining0.2480.12645.7610.142
Mutex lock/unlock0.0420.0550.7850.046
UTF-8 decode buffered0.0730.1400.2570.351
UTF-8 decode byte-by-byte0.1530.3950.2360.563
Stdio putc/getc0.2700.8087.7910.497
Stdio putc/getc unlocked0.2000.2820.2690.144
Regex compile0.0580.0410.0140.039
Regex search (a{25}b)0.1880.1880.9670.137
Self-exec (static linked)234μs245μs272μs457μs
Self-exec (dynamic linked)446μs590μs675μs864μs
ABI and versioning comparisonmusluClibcdietlibcglibc
Stable ABIyesnounofficiallyyes
LSB-compatible ABIincompletenonoyes
Backwards compatibilityyesnounofficiallyyes
Forwards compatibilityyesnounofficiallyno
Atomic upgradesyesnonono
Symbol versioningnononoyes
Algorithms comparisonmusluClibcdietlibcglibc
Substring search (strstr)twowaynaivenaivetwoway
Regular expressionsdfadfabacktrackingdfa
Sorting (qsort)smoothsortshellsortnaive quicksortintrosort
Allocator (malloc)musl-nativedlmallocdiet-nativeptmalloc
Features comparisonmusluClibcdietlibcglibc
Conformant printfyesyesnoyes
Exact floating point printingyesnonoyes
C99 math libraryyespartialnoyes
C11 threads APIyesnonono
C11 thread-local storageyesyesnoyes
GCC libstdc++ compatibilityyesyesnoyes
POSIX threadsyesyes, on most archsbrokenyes
POSIX process schedulingstubincorrectnoincorrect
POSIX thread priority schedulingyesyesnoyes
POSIX localedefnononoyes
Wide character interfacesyesyesminimalyes
Legacy 8-bit codepagesnoyesminimalslow, via gconv
Legacy CJK encodingsnononoslow, via gconv
UTF-8 multibytenative; 100% conformantnative; nonconformantdangerously nonconformantslow, via gconv; nonconformant
Iconv character conversionsmost major encodingsmainly UTFsnothe kitchen sink
Iconv transliteration extensionnononoyes
Openwall-style TCB shadowyesnonono
Sun RPC, NISnoyesyesyes
Zoneinfo (advanced timezones)yesnoyesyes
Gmon profilingnonoyesyes
Debugging featuresnononoyes
Various Linux extensionsyesyespartialyes
Target architectures comparisonmusluClibcdietlibcglibc
i386yesyesyesyes
x86_64yesyesyesyes
x86_64 x32 ABI (ILP32)experimentalnononon-conforming
ARMyesyesyesyes
Aarch64 (64-bit ARM)experimentalnonoyes
MIPSyesyesyesyes
SuperHexperimentalyesnoyes
Microblazeyespartialnoyes
PowerPCyesyesyesyes
Sparcnoyesyesyes
Alphanoyesyesyes
S/390nonoyesyes
OpenRISC 1000 (or1k)yesnononot upstream
MMU-less microcontrollersnoyesnono
Build environment comparisonmusluClibcdietlibcglibc
Legacy-code-friendly headerspartialyesnoyes
Lightweight headersyesnoyesno
Usable without native toolchainyesnoyesno
Respect for C namespaceyesLFS64 problemsnoLFS64 problems
Respect for POSIX namespaceyesLFS64 problemsnoLFS64 problems
Security/hardening comparisonmusluClibcdietlibcglibc
Attention to corner casesyesyesnotoo much malloc
Safe UTF-8 decoderyesyesnoyes
Avoids superlinear big-O‘syessometimesnoyes
Stack smashing protectionyesyesnoyes
Heap corruption detectionyesnonoyes
Misc. comparisonsmusluClibcdietlibcglibc
LicenseMITLGPL 2.1GPL 2LGPL 2.1+ w/exceptions

 

refered to: http://www.etalabs.net/compare_libcs.html


最新回复 (0)
返回