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


    Bloat comparisonmusluClibcdietlibcglibc
    Complete .a set 426k 500k 120k 2.0M †
    Complete .so set 527k 560k 185k 7.9M †
    Smallest static C program 1.8k 5k 0.2k 662k
    Static hello (using printf) 13k 70k 6k 662k
    Dynamic overhead (min. dirty) 20k 40k 40k 48k
    Static overhead (min. dirty) 8k 12k 8k 28k
    Static stdio overhead (min. dirty) 8k 24k 16k 36k
    Configurable featureset no yes minimal minimal
    Behavior on resource exhaustionmusluClibcdietlibcglibc
    Thread-local storage reports failure aborts n/a aborts
    SIGEV_THREAD timers no failure n/a n/a lost overruns
    pthread_cancel no failure aborts n/a aborts
    regcomp and regexec reports failure crashes reports failure crashes
    fnmatch no failure unknown no failure reports failure
    printf family no failure no failure no failure reports failure
    strtol family no failure no failure no failure no failure
    Performance comparisonmusluClibcdietlibcglibc
    Tiny allocation & free 0.005 0.004 0.013 0.002
    Big allocation & free 0.027 0.018 0.023 0.016
    Allocation contention, local 0.048 0.134 0.393 0.041
    Allocation contention, shared 0.050 0.132 0.394 0.062
    Zero-fill (memset) 0.023 0.048 0.055 0.012
    String length (strlen) 0.081 0.098 0.161 0.048
    Byte search (strchr) 0.142 0.243 0.198 0.028
    Substring (strstr) 0.057 1.273 1.030 0.088
    Thread creation/joining 0.248 0.126 45.761 0.142
    Mutex lock/unlock 0.042 0.055 0.785 0.046
    UTF-8 decode buffered 0.073 0.140 0.257 0.351
    UTF-8 decode byte-by-byte 0.153 0.395 0.236 0.563
    Stdio putc/getc 0.270 0.808 7.791 0.497
    Stdio putc/getc unlocked 0.200 0.282 0.269 0.144
    Regex compile 0.058 0.041 0.014 0.039
    Regex search (a{25}b) 0.188 0.188 0.967 0.137
    Self-exec (static linked) 234µs 245µs 272µs 457µs
    Self-exec (dynamic linked) 446µs 590µs 675µs 864µs
    ABI and versioning comparisonmusluClibcdietlibcglibc
    Stable ABI yes no unofficially yes
    LSB-compatible ABI incomplete no no yes
    Backwards compatibility yes no unofficially yes
    Forwards compatibility yes no unofficially no
    Atomic upgrades yes no no no
    Symbol versioning no no no yes
    Algorithms comparisonmusluClibcdietlibcglibc
    Substring search (strstr) twoway naive naive twoway
    Regular expressions dfa dfa backtracking dfa
    Sorting (qsort) smoothsort shellsort naive quicksort introsort
    Allocator (malloc) musl-native dlmalloc diet-native ptmalloc
    Features comparisonmusluClibcdietlibcglibc
    Conformant printf yes yes no yes
    Exact floating point printing yes no no yes
    C99 math library yes partial no yes
    C11 threads API yes no no no
    C11 thread-local storage yes yes no yes
    GCC libstdc++ compatibility yes yes no yes
    POSIX threads yes yes, on most archs broken yes
    POSIX process scheduling stub incorrect no incorrect
    POSIX thread priority scheduling yes yes no yes
    POSIX localedef no no no yes
    Wide character interfaces yes yes minimal yes
    Legacy 8-bit codepages no yes minimal slow, via gconv
    Legacy CJK encodings no no no slow, via gconv
    UTF-8 multibyte native; 100% conformant native; nonconformant dangerously nonconformant slow, via gconv; nonconformant
    Iconv character conversions most major encodings mainly UTFs no the kitchen sink
    Iconv transliteration extension no no no yes
    Openwall-style TCB shadow yes no no no
    Sun RPC, NIS no yes yes yes
    Zoneinfo (advanced timezones) yes no yes yes
    Gmon profiling no no yes yes
    Debugging features no no no yes
    Various Linux extensions yes yes partial yes
    Target architectures comparisonmusluClibcdietlibcglibc
    i386 yes yes yes yes
    x86_64 yes yes yes yes
    x86_64 x32 ABI (ILP32) experimental no no non-conforming
    ARM yes yes yes yes
    Aarch64 (64-bit ARM) experimental no no yes
    MIPS yes yes yes yes
    SuperH experimental yes no yes
    Microblaze yes partial no yes
    PowerPC yes yes yes yes
    Sparc no yes yes yes
    Alpha no yes yes yes
    S/390 no no yes yes
    OpenRISC 1000 (or1k) yes no no not upstream
    MMU-less microcontrollers no yes no no
    Build environment comparisonmusluClibcdietlibcglibc
    Legacy-code-friendly headers partial yes no yes
    Lightweight headers yes no yes no
    Usable without native toolchain yes no yes no
    Respect for C namespace yes LFS64 problems no LFS64 problems
    Respect for POSIX namespace yes LFS64 problems no LFS64 problems
    Security/hardening comparisonmusluClibcdietlibcglibc
    Attention to corner cases yes yes no too much malloc
    Safe UTF-8 decoder yes yes no yes
    Avoids superlinear big-O's yes sometimes no yes
    Stack smashing protection yes yes no yes
    Heap corruption detection yes no no yes
    Misc. comparisonsmusluClibcdietlibcglibc
    License MIT LGPL 2.1 GPL 2 LGPL 2.1+ w/exceptions

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

  • 相关阅读:
    Oneops运维系统
    采集日志工具fluentbit输出到kafka
    logstash
    Redux学习笔记
    部分浏览器不支持 replaceAll的解决
    windows10系统文件浏览器不显示图片缩略图
    C#项目版本号自定义位置自动向上增加小工具设计与实现
    父类和子类同名的变量和方法决定于哪个
    JdbcTemplate基本使用 增删该差API
    Tomcat结合Web Maven
  • 原文地址:https://www.cnblogs.com/merlindu/p/6370825.html
Copyright © 2020-2023  润新知