Core
nelibc
A C library, rebuilt piece by piece in Nelua.
Replace selected libc functions with Nelua implementations, using glibc, musl or Cosmopolitan for the rest; or use the standalone runtime with no external libc. Spaceghost/nelibc is experimental, Linux x86-64, with hybrid builds working and the standalone profile in progress. The implementations are Nelua, with x86-64 assembly for memory primitives and C adapters at the runtime boundaries.
819 / 1,471 exports · glibc793 / 1,471 exports · musl / Zig399 / 1,471 exports · Cosmopolitancomparison 2026-11-21 UTC
Five runtime arrangements
The C interface stays familiar while ownership changes. Compiler choice (GCC, Zig or TinyCC) is a separate axis from the runtime supplying the missing functions.
| Profile | Nelibc owns | Underlying runtime |
|---|---|---|
| glibc hybrid | The selected Nelua implementations and adapters | GNU libc supplies uncovered APIs and runtime support |
| musl hybrid | The selected Nelua implementations, with musl-specific adapters | musl supplies uncovered APIs and runtime support |
| Cosmopolitan hybrid | Memory, strings, narrow character classification, floating conversion, IP conversion, real and complex math | Cosmopolitan owns startup, allocation, FILE streams, threads, filesystem calls, resolver and integer conversion |
| Standalone | Its own startup, allocator, stdio, threading subset, locale and other implemented APIs | Linux x86-64 kernel services; uncovered functionality remains implementation work |
| Host | The standalone implementations over a callback dispatcher | A kernel or embedding host supplies console, memory, clocks, TLS and exit; current pthreads are cooperative lanes on one hardware thread |
The Cosmopolitan profile is deliberately narrower than the older hybrids. A FILE stream, allocation or thread must stay with the runtime that owns its state. Removing glibc does not mean removing the fallback libc. Linux x86-64 is the tested platform; cross-platform runtime conformance is not established.
Repeated-byte substring search
Median microseconds for a 64 KiB miss on 21 November 2026. GCC 12.2, glibc 2.36 and Nelibc’s GCC hybrid ran in nine rotating rounds on an i5-10400.
| Miss | 70bcd89 (µs) | 84267ab (µs) | glibc (µs) |
|---|---|---|---|
| strstr · ab / aa | 39.36 | 3.76 | 2.52 |
| strstr · 63 / 64 a bytes | 1.65 | 1.71 | 5.88 |
| strstr · One interior b | 118.77 | 1.32 | 269.79 |
| memmem · ab / aa | 217.87 | 2.88 | 44.05 |
| memmem · 63 / 64 a bytes | 1.06 | 1.06 | 8.15 |
| memmem · One interior b | 126.89 | 0.67 | 268.17 |
First-match timings
Each cell shows the previous revision, updated revision and glibc medians in microseconds. Early matches begin near the start of the buffer. Late matches end at the last haystack byte.
| Function and input | Early match (µs) | Late match (µs) |
|---|---|---|
| strstr · alternating | 0.669 / 0.010 / 0.010 | 39.667 / 3.603 / 2.508 |
| strstr · interior | 0.988 / 1.008 / 0.348 | 118.281 / 1.662 / 268.864 |
| strstr · runs63 | 0.908 / 0.036 / 0.039 | 1.676 / 1.760 / 5.910 |
| memmem · alternating | 0.030 / 0.004 / 0.009 | 220.952 / 3.098 / 43.818 |
| memmem · interior | 0.370 / 0.443 / 0.137 | 116.757 / 1.064 / 270.268 |
| memmem · runs63 | 0.227 / 0.269 / 0.053 | 1.075 / 1.069 / 8.110 |
The same harness covers early and late hits, binary data, text, and seeded random bytes. For the 128-byte needle with an interior b, early memmem hits rose from 370 to 443 ns. The 64-byte uniform needle’s early memmem hit rose from 227 to 269 ns. Each timed call checked the first offset against a bytewise oracle. Guard-page checks ran before timing.
Searches in the project READMEManual gate resultsFedora CIReplay scriptExisting benchmark controlsAll substring samplesQuartiles and observed rangesVersions and reproduction
Completion: whose implementation is it?
Fresh archive-symbol census, 2026-11-21 UTC. The denominator is the same pinned musl 1.2.5 inventory for every profile. Runtime-alone and combined columns count defined names in the libc and its math/runtime companion archives: glibc libc/libm, musl plus Zig libzigc/compiler_rt, and Cosmopolitan libcosmo. Owned counts name the implementations Nelibc exports. This is symbol presence, not a test of every individual link or standards conformance. A name absent from Nelibc may still be supplied by the fallback libc.
| Profile | Runtime alone | Runtime + Nelibc | Owned by Nelibc |
|---|---|---|---|
| glibc | 1,439 / 1,471 | 1,444 / 1,471 | 819 (55.7%) |
| musl / Zig | 1,471 / 1,471 | 1,471 / 1,471 | 793 (53.9%) |
| Cosmopolitan | 1,239 / 1,471 | 1,257 / 1,471 | 399 (27.1%) |
Cosmopolitan is the default hybrid build at the measured revision. Its archive supplies many APIs directly. The table shows which symbols Nelibc supplies when added to each runtime. The combined count is a union, so replacing an existing function does not add another API name. The coverage explorer lists individual symbols for each profile and lets you switch inventories.
Conformance: the same tests, with and without Nelibc
musl libc-test 63e36e934e8f, functional, regression and math corpus, run 2026-11-21 UTC. Both halves of each pair use the same libc-owned headers. Every result is shown; no expected-failure list turns a failing test into a pass.
| Build | Planned | Pass | Build fail | Link fail | Runtime fail | Timeout | Not run |
|---|---|---|---|---|---|---|---|
| glibc alone | 343 | 301 | 4 | 0 | 37 | 1 | 0 |
| glibc + Nelibc | 343 | 325 | 4 | 0 | 13 | 1 | 0 |
| musl / Zig alone | 343 | 327 | 0 | 1 | 15 | 0 | 0 |
| musl / Zig + Nelibc | 343 | 333 | 0 | 1 | 9 | 0 | 0 |
| Cosmopolitan alone | 343 | 279 | 11 | 10 | 43 | 0 | 0 |
| Cosmopolitan + Nelibc | 343 | 301 | 11 | 4 | 27 | 0 | 0 |
Changes relative to each baseline: glibc: 24 newly passing, 0 new non-passes; musl / Zig: 7 newly passing, 1 new non-passes; Cosmopolitan: 23 newly passing, 1 new non-passes. Build and link failures count as non-passes in these deltas.
In the first conformance run on this revision, Cosmopolitan alone passed 279 tests and Cosmopolitan with Nelibc passed 301. Their timeout counts were 0 and 0, respectively. Both sets of compiled tests were then repeated in the same guest. Each executable was read into the page cache before the original supervisor started its five-second timer. The table uses the repeated pair. Initial per-test results · Repeat conditions · Corpus build identities.
The Cosmopolitan functional/popen test also ran 2,000 times each on native Cosmopolitan, previous Nelibc and current Nelibc. The child exited on SIGPIPE in 2, 1 and 4 trials respectively. The table retains the full-corpus outcomes. Test executable identities and individual failed trials.
All 9 benchmark consumers also passed 1995 targeted assertions each before timing. Those assertions cover the benchmarked operations and are separate from libc-test. The independent corpus uses libc-test's native supervisor, a 100 KiB stack limit and five-second per-test timeout. Cosmopolitan executables use its native APE loader in both halves of the pair. The corpus includes musl-specific, platform and extension expectations; a non-pass is not by itself proof of a standards violation. This is measured test coverage, not certification of all C or POSIX behavior. Historical Nelibc-header and standalone gates are listed separately below.
Tests newly failing or newly passing in each pair
glibc
New non-passes: none
New passes: functional/clocale_mbfuncs, functional/fnmatch, functional/strftime, functional/strtol, functional/wcstol, math/exp2l, math/fma, math/fmaf, math/fmax, math/fmaxf, math/fmaxl, math/fmin, math/fminf, math/fminl, math/j1, math/j1f, math/jn, math/jnf, math/powf, math/tgammaf, math/y0, math/yn, math/ynf, regression/fpclassify-invalid-ld80
musl / Zig
New non-passes: regression/sigprocmask-internal
New passes: functional/strptime, math/expl, math/fma, math/fmaf, math/fmal, math/powf, math/powl
Cosmopolitan
New non-passes: functional/popen
New passes: functional/inet_pton, functional/strtold, math/coshl, math/dremf, math/erfcf, math/exp10l, math/fma, math/fmaf, math/fmal, math/j1f, math/llrintl, math/llround, math/llroundf, math/llroundl, math/log1p, math/log1pf, math/lrintl, math/pow10l, math/powf, math/powl, math/sinhf, math/sinhl, regression/inet_ntop-v4mapped
Build and integration checks
On 2026-11-21 the measured revision passed 14 of 14 Makefile targets as an unprivileged user in the x86-64 Linux build guest. Four libc-test targets compare failures with the project’s existing expected-failure lists. The independent corpus above counts each test result directly. Download the per-target results.
| Target | Exit | Seconds |
|---|---|---|
| sys-ops-check | 0 | 0 |
| purity-check | 0 | 0 |
| smoke-cosmo | 0 | 11 |
| host-matrix | 0 | 59 |
| host-bend-hello-zig | 0 | 11 |
| host-bend-parallel-zig | 0 | 5 |
| host-snapshot-matrix | 0 | 14 |
| dogfood-matrix | 0 | 108 |
| smoke-matrix | 0 | 171 |
| libc-test-gcc | 0 | 24 |
| libc-test-zig | 0 | 102 |
| libc-test-standalone-gcc | 0 | 22 |
| libc-test-standalone-zig | 0 | 22 |
| shootout-matrix | 0 | 614 |
On 2026-11-21, CI on Fedora Linux (x86-64) passed the host, Bend, standalone, freestanding and generated-C checks at eef2cefc. The library source matches the benchmark revision. Fedora check results.
Performance
2026-11-21 UTC · Linux x86-64
For an 8-byte buffer with no matching byte, the Cosmopolitan consumer measured 3.98 ns with previous Nelibc, 2.77 ns with current Nelibc, and 2.24 ns with Cosmopolitan alone. Paired median ratios were 1.45× previous/current (1.41–1.48× observed) and 0.82× native/current (0.80–0.83× observed).
The table tracks the three operations that prompted this work. Its last column gives the median of seven paired native-to-current ratios. The separate controls below vary the inputs and alignments.
| Runtime | Operation | Native | Previous Nelibc | Current Nelibc | Native ÷ current |
|---|---|---|---|---|---|
| glibc | strlen · 128 B | 2.72 | 2.77 | 2.72 | 1.00× |
| Cosmopolitan | memchr-absent · 8 B | 2.24 | 3.98 | 2.77 | 0.82× |
| glibc | strtod-decimal | 101.72 | 109.69 | 109.49 | 0.93× |
Length, alignment and match-position controls for strlen and memchr · Decimal length, alignment and rounding controls for strtod.
Match position matters. In the aligned eight-byte control, finding the first byte took 1.73 ns with previous Nelibc, 2.00 ns with current Nelibc and 2.26 ns with native Cosmopolitan.
The musl executables placed their buffers at different offsets within a page. At identical offsets, 128-byte copies took 3.26 and 3.22 ns with previous and current Nelibc. Near the page end, the same pair took 6.09 and 6.09 ns. Compare both placements for copy, move, search and length.
Each profile compares the same consumer with and without Nelibc. Speedups above 1× favor Nelibc. Browse 171 results across 3 profiles.
All 171 benchmark results
Of 163 cases that called a Nelibc export, 101 ran faster than their native libc in all 7 rounds, 28 ran slower in every round, and 34 had an observed range that included 1×. Each case has equal weight here.
Times are median nanoseconds per call. Speedup is the median of the paired native time divided by the Nelibc time. The range shows the smallest and largest paired ratios. Download the results (CSV) · Raw matched samples
glibc · 57 results
| Case | Input bytes | Native ns/op | + Nelibc ns/op | Speedup | Observed range | Implementation |
|---|---|---|---|---|---|---|
| memcpy | 8 | 2.47 | 2.60 | 0.959× | 0.585–1.05× | Nelibc export |
| memcpy | 32 | 2.00 | 2.28 | 0.869× | 0.814–0.916× | Nelibc export |
| memcpy | 128 | 2.55 | 2.76 | 0.924× | 0.865–0.973× | Nelibc export |
| memcpy | 1,024 | 9.42 | 9.18 | 1.02× | 0.98–1.03× | Nelibc export |
| memcpy | 4,096 | 32.88 | 32.31 | 1.02× | 0.994–1.29× | Nelibc export |
| memcpy | 65,536 | 1,222.84 | 1,223.51 | 0.958× | 0.686–1.06× | Nelibc export |
| memmove-overlap | 8 | 4.02 | 3.75 | 1.07× | 0.958–1.09× | Nelibc export |
| memmove-overlap | 32 | 4.27 | 3.79 | 1.14× | 1.1–1.17× | Nelibc export |
| memmove-overlap | 128 | 4.50 | 5.04 | 0.892× | 0.842–0.932× | Nelibc export |
| memmove-overlap | 1,024 | 12.93 | 20.20 | 0.642× | 0.629–0.66× | Nelibc export |
| memmove-overlap | 4,096 | 36.59 | 40.34 | 0.907× | 0.749–0.972× | Nelibc export |
| memmove-overlap | 65,536 | 866.65 | 853.56 | 1.01× | 0.657–1.06× | Nelibc export |
| memset | 8 | 2.77 | 2.74 | 1× | 0.966–1.1× | Nelibc export |
| memset | 32 | 2.26 | 2.28 | 0.986× | 0.96–1.17× | Nelibc export |
| memset | 128 | 2.73 | 2.73 | 1.01× | 0.957–1.02× | Nelibc export |
| memset | 1,024 | 8.30 | 8.31 | 0.999× | 0.957–1.03× | Nelibc export |
| memset | 4,096 | 38.71 | 37.44 | 1.04× | 0.984–1.06× | Nelibc export |
| memset | 65,536 | 1,091.63 | 1,109.46 | 1× | 0.855–1.06× | Nelibc export |
| memcmp-equal | 8 | 2.72 | 2.22 | 1.23× | 1.18–1.24× | Nelibc export |
| memcmp-equal | 32 | 2.98 | 2.48 | 1.2× | 1.16–1.23× | Nelibc export |
| memcmp-equal | 128 | 3.22 | 2.95 | 1.09× | 1.05–1.12× | Nelibc export |
| memcmp-equal | 1,024 | 9.71 | 9.63 | 0.998× | 0.959–1.02× | Nelibc export |
| memcmp-equal | 4,096 | 37.61 | 34.18 | 1.11× | 1.02–1.15× | Nelibc export |
| memcmp-equal | 65,536 | 1,291.78 | 1,253.13 | 1.02× | 0.971–1.05× | Nelibc export |
| memchr-absent | 8 | 2.70 | 3.41 | 0.804× | 0.577–0.84× | Nelibc export |
| memchr-absent | 32 | 2.74 | 2.76 | 1× | 0.981–1.02× | Nelibc export |
| memchr-absent | 128 | 3.22 | 4.27 | 0.755× | 0.742–0.783× | Nelibc export |
| memchr-absent | 1,024 | 8.56 | 11.10 | 0.785× | 0.751–0.807× | Nelibc export |
| memchr-absent | 4,096 | 26.32 | 32.97 | 0.809× | 0.723–0.892× | Nelibc export |
| memchr-absent | 65,536 | 609.83 | 626.43 | 0.985× | 0.899–1.04× | Nelibc export |
| strlen | 8 | 2.00 | 2.23 | 0.894× | 0.886–0.916× | Nelibc export |
| strlen | 32 | 2.51 | 2.24 | 1.11× | 1.06–1.14× | Nelibc export |
| strlen | 128 | 2.72 | 2.72 | 1× | 0.983–1.03× | Nelibc export |
| strlen | 1,024 | 7.65 | 8.46 | 0.904× | 0.878–1.15× | Nelibc export |
| strlen | 4,096 | 21.81 | 20.95 | 1.05× | 0.989–1.15× | Nelibc export |
| strlen | 65,536 | 554.76 | 607.92 | 0.913× | 0.869–1.1× | Nelibc export |
| strcmp-equal | 8 | 2.48 | 2.21 | 1.11× | 0.995–1.13× | Nelibc export |
| strcmp-equal | 32 | 2.73 | 3.23 | 0.834× | 0.814–0.879× | Nelibc export |
| strcmp-equal | 128 | 5.65 | 6.93 | 0.821× | 0.768–0.838× | Nelibc export |
| strcmp-equal | 1,024 | 14.62 | 17.60 | 0.842× | 0.813–0.864× | Nelibc export |
| strcmp-equal | 4,096 | 48.11 | 59.02 | 0.799× | 0.738–0.89× | Nelibc export |
| strcmp-equal | 65,536 | 1,353.70 | 1,388.20 | 0.999× | 0.932–1.01× | Nelibc export |
| strstr-tail | 8 | 11.46 | 15.06 | 0.757× | 0.74–0.851× | Nelibc export |
| strstr-tail | 32 | 69.83 | 62.97 | 1.09× | 1.07–1.19× | Nelibc export |
| strstr-tail | 128 | 359.59 | 77.79 | 4.68× | 4.49–4.85× | Nelibc export |
| strstr-tail | 1,024 | 3,381.72 | 92.34 | 36.8× | 35.6–39.9× | Nelibc export |
| strstr-tail | 4,096 | 15,081.97 | 129.26 | 119× | 111–120× | Nelibc export |
| strstr-tail | 65,536 | 243,161.44 | 1,326.20 | 184× | 151–190× | Nelibc export |
| strtol-decimal | — | 15.65 | 13.51 | 1.16× | 0.887–1.18× | Nelibc export |
| strtod-decimal | — | 101.72 | 109.49 | 0.933× | 0.901–0.955× | Nelibc export |
| sin | — | 8.25 | 5.85 | 1.42× | 1.39–1.68× | Nelibc export |
| sqrt | — | 2.76 | 2.22 | 1.22× | 1.18–1.28× | Nelibc export |
| malloc-free | 64 | 9.03 | 12.97 | 0.694× | 0.673–0.724× | Nelibc export |
| malloc-free | 4,096 | 17.98 | 14.45 | 1.25× | 1.22–1.31× | Nelibc export |
| snprintf-mixed | — | 179.86 | 241.06 | 0.762× | 0.66–0.785× | Nelibc export |
| qsort-128-integers | — | 2,184.77 | 1,962.29 | 1.11× | 1.09–1.2× | Nelibc export |
| parse-record | — | 188.42 | 164.25 | 1.16× | 1.12–1.2× | mixed workload |
musl / Zig · 57 results
| Case | Input bytes | Native ns/op | + Nelibc ns/op | Speedup | Observed range | Implementation |
|---|---|---|---|---|---|---|
| memcpy | 8 | 2.24 | 2.28 | 0.967× | 0.559–1.03× | Nelibc export |
| memcpy | 32 | 3.40 | 2.03 | 1.68× | 1.51–2.18× | Nelibc export |
| memcpy | 128 | 4.75 | 6.05 | 0.788× | 0.67–0.845× | Nelibc export |
| memcpy | 1,024 | 21.65 | 16.10 | 1.35× | 1.3–1.45× | Nelibc export |
| memcpy | 4,096 | 85.40 | 52.72 | 1.62× | 1.57–1.67× | Nelibc export |
| memcpy | 65,536 | 1,779.29 | 1,243.50 | 1.42× | 1.31–1.52× | Nelibc export |
| memmove-overlap | 8 | 4.45 | 3.93 | 1.12× | 1.08–1.18× | Nelibc export |
| memmove-overlap | 32 | 6.14 | 8.37 | 0.723× | 0.699–0.828× | Nelibc export |
| memmove-overlap | 128 | 7.47 | 10.66 | 0.697× | 0.66–0.729× | Nelibc export |
| memmove-overlap | 1,024 | 21.30 | 28.63 | 0.75× | 0.707–0.819× | Nelibc export |
| memmove-overlap | 4,096 | 68.79 | 39.75 | 1.75× | 1.67–1.78× | Nelibc export |
| memmove-overlap | 65,536 | 1,421.03 | 846.96 | 1.66× | 1.6–1.71× | Nelibc export |
| memset | 8 | 2.01 | 2.50 | 0.809× | 0.75–0.832× | Nelibc export |
| memset | 32 | 2.03 | 1.98 | 0.994× | 0.986–1.05× | Nelibc export |
| memset | 128 | 4.22 | 2.45 | 1.68× | 1.62–1.75× | Nelibc export |
| memset | 1,024 | 16.60 | 8.74 | 1.9× | 1.83–1.99× | Nelibc export |
| memset | 4,096 | 64.85 | 37.76 | 1.74× | 1.69–1.8× | Nelibc export |
| memset | 65,536 | 1,352.80 | 1,096.23 | 1.22× | 1.08–1.42× | Nelibc export |
| memcmp-equal | 8 | 3.98 | 2.47 | 1.61× | 1.55–1.64× | Nelibc export |
| memcmp-equal | 32 | 21.94 | 2.45 | 8.95× | 8.55–9.65× | Nelibc export |
| memcmp-equal | 128 | 46.93 | 3.26 | 14.5× | 5.7–14.8× | Nelibc export |
| memcmp-equal | 1,024 | 328.74 | 11.42 | 28.2× | 20.9–29.4× | Nelibc export |
| memcmp-equal | 4,096 | 1,293.96 | 45.54 | 27.9× | 27–29.2× | Nelibc export |
| memcmp-equal | 65,536 | 20,209.60 | 1,709.19 | 11.8× | 11.5–13× | Nelibc export |
| memchr-absent | 8 | 3.71 | 2.78 | 1.33× | 1.31–1.39× | Nelibc export |
| memchr-absent | 32 | 19.15 | 2.47 | 7.79× | 7.63–8.38× | Nelibc export |
| memchr-absent | 128 | 40.71 | 4.17 | 9.77× | 9.24–10.1× | Nelibc export |
| memchr-absent | 1,024 | 261.92 | 10.96 | 24.1× | 16.2–25× | Nelibc export |
| memchr-absent | 4,096 | 1,043.73 | 33.18 | 30.8× | 28–31.6× | Nelibc export |
| memchr-absent | 65,536 | 16,677.50 | 667.80 | 25.1× | 24.5–29.3× | Nelibc export |
| strlen | 8 | 4.55 | 3.51 | 1.29× | 1.27–1.32× | Nelibc export |
| strlen | 32 | 19.92 | 4.22 | 4.72× | 4.3–4.76× | Nelibc export |
| strlen | 128 | 46.10 | 4.44 | 10.4× | 9.94–10.6× | Nelibc export |
| strlen | 1,024 | 320.04 | 9.55 | 32.7× | 31.4–35.5× | Nelibc export |
| strlen | 4,096 | 1,243.02 | 22.48 | 55.1× | 45.6–75× | Nelibc export |
| strlen | 65,536 | 19,672.22 | 588.21 | 33.5× | 31–35.3× | Nelibc export |
| strcmp-equal | 8 | 5.47 | 2.73 | 2.02× | 1.52–2.14× | Nelibc export |
| strcmp-equal | 32 | 17.60 | 5.29 | 3.36× | 3.04–3.5× | Nelibc export |
| strcmp-equal | 128 | 72.04 | 7.54 | 9.35× | 8.13–9.76× | Nelibc export |
| strcmp-equal | 1,024 | 521.47 | 19.54 | 27× | 24.9–34.5× | Nelibc export |
| strcmp-equal | 4,096 | 2,072.57 | 60.32 | 34.6× | 32.1–36.2× | Nelibc export |
| strcmp-equal | 65,536 | 32,960.39 | 1,728.78 | 19.1× | 17.9–19.5× | Nelibc export |
| strstr-tail | 8 | 18.30 | 10.10 | 1.81× | 1.05–1.93× | Nelibc export |
| strstr-tail | 32 | 89.31 | 48.64 | 1.87× | 1.7–2.02× | Nelibc export |
| strstr-tail | 128 | 563.07 | 59.64 | 9.59× | 9.17–9.99× | Nelibc export |
| strstr-tail | 1,024 | 4,012.67 | 70.32 | 58× | 56.1–61.3× | Nelibc export |
| strstr-tail | 4,096 | 15,871.66 | 107.49 | 150× | 139–152× | Nelibc export |
| strstr-tail | 65,536 | 256,641.78 | 1,308.31 | 193× | 189–199× | Nelibc export |
| strtol-decimal | — | 11.68 | 14.09 | 0.831× | 0.811–1.12× | Nelibc export |
| strtod-decimal | — | 474.99 | 122.33 | 3.85× | 3.71–3.97× | Nelibc export |
| sin | — | 5.84 | 6.72 | 0.871× | 0.747–0.887× | Nelibc export |
| sqrt | — | 10.88 | 2.74 | 3.94× | 3.59–4.16× | Nelibc export |
| malloc-free | 64 | 18.09 | 15.90 | 1.16× | 1.09–1.22× | Nelibc export |
| malloc-free | 4,096 | 18.20 | 16.78 | 1.1× | 0.864–1.12× | Nelibc export |
| snprintf-mixed | — | 255.82 | 262.41 | 0.975× | 0.924–1.02× | Nelibc export |
| qsort-128-integers | — | 4,904.62 | 1,799.42 | 2.69× | 2.4–3× | Nelibc export |
| parse-record | — | 608.04 | 181.62 | 3.38× | 3.31–3.44× | mixed workload |
Cosmopolitan · 57 results
| Case | Input bytes | Native ns/op | + Nelibc ns/op | Speedup | Observed range | Implementation |
|---|---|---|---|---|---|---|
| memcpy | 8 | 4.15 | 2.21 | 1.86× | 1.79–1.89× | Nelibc export |
| memcpy | 32 | 4.04 | 1.96 | 2.06× | 1.99–2.15× | Nelibc export |
| memcpy | 128 | 6.93 | 2.47 | 2.8× | 2.67–2.88× | Nelibc export |
| memcpy | 1,024 | 18.19 | 9.08 | 2× | 1.88–2.03× | Nelibc export |
| memcpy | 4,096 | 43.61 | 32.03 | 1.37× | 1.3–1.39× | Nelibc export |
| memcpy | 65,536 | 1,211.38 | 1,198.49 | 0.999× | 0.967–1.02× | Nelibc export |
| memmove-overlap | 8 | 3.90 | 3.74 | 1.06× | 1.02–1.22× | Nelibc export |
| memmove-overlap | 32 | 3.92 | 4.02 | 0.992× | 0.933–1.04× | Nelibc export |
| memmove-overlap | 128 | 5.85 | 5.68 | 1.02× | 0.994–1.09× | Nelibc export |
| memmove-overlap | 1,024 | 298.91 | 26.77 | 11.1× | 11–12.3× | Nelibc export |
| memmove-overlap | 4,096 | 1,050.98 | 39.07 | 27× | 26.3–28× | Nelibc export |
| memmove-overlap | 65,536 | 16,537.25 | 843.70 | 19.6× | 19.3–19.8× | Nelibc export |
| memset | 8 | 2.23 | 2.95 | 0.752× | 0.743–0.766× | Nelibc export |
| memset | 32 | 2.97 | 2.45 | 1.21× | 1.17–1.28× | Nelibc export |
| memset | 128 | 4.83 | 2.72 | 1.76× | 1.7–1.91× | Nelibc export |
| memset | 1,024 | 15.10 | 8.20 | 1.8× | 1.61–1.95× | Nelibc export |
| memset | 4,096 | 38.55 | 37.66 | 1.03× | 0.991–1.08× | Nelibc export |
| memset | 65,536 | 1,070.80 | 1,113.77 | 0.944× | 0.701–1.15× | Nelibc export |
| memcmp-equal | 8 | 1.99 | 2.71 | 0.735× | 0.706–1.16× | Nelibc export |
| memcmp-equal | 32 | 3.96 | 2.72 | 1.46× | 1.36–1.5× | Nelibc export |
| memcmp-equal | 128 | 5.44 | 2.96 | 1.84× | 1.76–1.91× | Nelibc export |
| memcmp-equal | 1,024 | 26.01 | 9.76 | 2.67× | 2.63–3.98× | Nelibc export |
| memcmp-equal | 4,096 | 98.30 | 33.75 | 2.95× | 2.83–3.14× | Nelibc export |
| memcmp-equal | 65,536 | 2,357.21 | 1,290.57 | 1.83× | 1.74–1.92× | Nelibc export |
| memchr-absent | 8 | 2.24 | 2.77 | 0.818× | 0.799–0.83× | Nelibc export |
| memchr-absent | 32 | 3.47 | 2.46 | 1.4× | 1.33–1.62× | Nelibc export |
| memchr-absent | 128 | 6.92 | 4.27 | 1.63× | 1.6–1.69× | Nelibc export |
| memchr-absent | 1,024 | 35.13 | 10.99 | 3.2× | 3.11–3.28× | Nelibc export |
| memchr-absent | 4,096 | 134.79 | 32.76 | 4.16× | 4.06–4.23× | Nelibc export |
| memchr-absent | 65,536 | 2,030.87 | 627.34 | 3.26× | 3.08–3.35× | Nelibc export |
| strlen | 8 | 3.45 | 2.47 | 1.39× | 1.34–1.52× | Nelibc export |
| strlen | 32 | 3.51 | 2.48 | 1.41× | 1.33–1.48× | Nelibc export |
| strlen | 128 | 5.02 | 2.98 | 1.69× | 1.54–1.81× | Nelibc export |
| strlen | 1,024 | 19.70 | 8.64 | 2.27× | 2.12–2.35× | Nelibc export |
| strlen | 4,096 | 80.24 | 21.24 | 3.84× | 3.47–6.73× | Nelibc export |
| strlen | 65,536 | 1,423.33 | 592.34 | 2.4× | 2.32–2.49× | Nelibc export |
| strcmp-equal | 8 | 3.75 | 1.99 | 1.87× | 1.75–1.92× | Nelibc export |
| strcmp-equal | 32 | 5.99 | 3.29 | 1.86× | 1.79–1.88× | Nelibc export |
| strcmp-equal | 128 | 15.05 | 7.80 | 1.97× | 1.88–2.69× | Nelibc export |
| strcmp-equal | 1,024 | 106.95 | 23.34 | 4.61× | 4.5–4.95× | Nelibc export |
| strcmp-equal | 4,096 | 386.38 | 62.88 | 6.23× | 6.09–6.46× | Nelibc export |
| strcmp-equal | 65,536 | 6,137.13 | 1,395.62 | 4.42× | 4.05–4.57× | Nelibc export |
| strstr-tail | 8 | 23.08 | 14.31 | 1.62× | 1.43–1.7× | Nelibc export |
| strstr-tail | 32 | 170.95 | 57.65 | 2.99× | 2.85–3.02× | Nelibc export |
| strstr-tail | 128 | 733.56 | 74.10 | 9.87× | 9.54–10.2× | Nelibc export |
| strstr-tail | 1,024 | 5,923.80 | 88.82 | 66.9× | 64.8–68.8× | Nelibc export |
| strstr-tail | 4,096 | 23,689.20 | 124.05 | 186× | 185–200× | Nelibc export |
| strstr-tail | 65,536 | 375,004.19 | 1,338.91 | 282× | 271–293× | Nelibc export |
| strtol-decimal | — | 12.23 | 12.50 | 0.995× | 0.941–1.02× | delegated |
| strtod-decimal | — | 512.90 | 86.69 | 5.93× | 5.69–6.02× | Nelibc export |
| sin | — | 5.31 | 6.08 | 0.859× | 0.767–0.886× | Nelibc export |
| sqrt | — | 2.05 | 2.26 | 0.912× | 0.845–0.944× | Nelibc export |
| malloc-free | 64 | 10.89 | 10.99 | 0.99× | 0.948–1.04× | delegated |
| malloc-free | 4,096 | 11.66 | 11.71 | 0.998× | 0.917–1.19× | delegated |
| snprintf-mixed | — | 197.51 | 195.34 | 1.01× | 0.985–1.04× | delegated |
| qsort-128-integers | — | 2,458.61 | 2,460.48 | 0.995× | 0.977–1.04× | delegated |
| parse-record | — | 580.82 | 129.99 | 4.43× | 4.35–4.69× | mixed workload |
Optimization follow-up: the previous revision and the measured revision
The previous production archives were saved before changing the implementations. Each profile now rotates three builds of the same consumer: libc alone, the previous Nelibc candidate, and the new candidate. This table uses Cosmopolitan only. The three builds run in rotating order on the same CPU.
| Case | Previous Nelibc | New Nelibc | Cosmopolitan alone | Gain vs previous |
|---|---|---|---|---|
| memchr-absent · 8 B | 3.98 | 2.77 | 2.24 | 1.45× |
| memchr-absent · 32 B | 2.71 | 2.46 | 3.47 | 1.10× |
| memchr-absent · 128 B | 4.26 | 4.27 | 6.92 | 1.00× |
| memchr-absent · 65536 B | 619.14 | 627.34 | 2030.87 | 0.99× |
On x86-64, the Cosmopolitan build scans a single eight-byte group before its tail. Clang checks that a word fits within the current page before loading it, then locates the first matching byte. Near a page edge it scans in order. Both paths are written in Nelua. The timed wrappers keep calls observable, so these gains measure the implementations. Slower cases and all raw samples remain below.
Independent numerical and guard-page checks · Optimization notes and verification · Reproduce this comparison · Memchr length, alignment and hit-position controls · Raw memchr control samples · Memchr control run manifests · Decimal controls by input and byte offset · Raw decimal control samples · Decimal control run manifest · Decimal control inputs and checks · Decimal control driver · Musl page-placement controls · Raw placement samples · Observed page offsets and archive hashes · Musl placement driver
Measured revisions: 84267ab9185f before the change and eef2cefc548e after it. The manifest identifies each linked archive by SHA-256.
Source revisions: previous 84267ab9185f25c88eca4cd10366207a5028ecc7, measured eef2cefc548e6e25760c653ef31154f460bf7690. Run manifest and archive identities · Matched benchmark samples · Memchr length, alignment and hit-position controls · Paired raw control samples · Reproduce this comparison · Reproduce the previous immutable comparison.
| Case | glibc → +Nelibc | musl/Zig → +Nelibc | Cosmopolitan → +Nelibc |
|---|---|---|---|
| memcpy · 4,096 B | 1.02× | 1.62× | 1.37× |
| memmove-overlap · 128 B | 0.89× | 0.70× | 1.02× |
| memset · 4,096 B | 1.04× | 1.74× | 1.03× |
| memcmp-equal · 128 B | 1.09× | 14.48× | 1.84× |
| memchr-absent · 128 B | 0.76× | 9.77× | 1.63× |
| strlen · 128 B | 1.00× | 10.39× | 1.69× |
| strcmp-equal · 128 B | 0.82× | 9.35× | 1.97× |
| strstr-tail · 128 B | 4.68× | 9.59× | 9.87× |
| strtol-decimal | 1.16× | 0.83× | 0.99× delegated |
| strtod-decimal | 0.93× | 3.85× | 5.93× |
| sin | 1.42× | 0.87× | 0.86× |
| sqrt | 1.22× | 3.94× | 0.91× |
| malloc-free · 64 B | 0.69× | 1.16× | 0.99× delegated |
| snprintf-mixed | 0.76× | 0.97× | 1.01× delegated |
| qsort-128-integers | 1.11× | 2.69× | 0.99× delegated |
| parse-record | 1.16× mixed workload | 3.38× mixed workload | 4.43× mixed workload |
7 comparison rounds (rotating triplets with the previous candidate), rotating profile order. Each timed loop runs for at least 5 ms after calibration. Consumer flags include -O2 -fno-builtin; volatile pointers to noinline direct-call wrappers stop pure-function calls being hoisted out of the loop. The same wrappers are used in every profile. Taking the address of Cosmopolitan 4.0.2’s strstr IFUNC failed in this toolchain; direct calls passed, so this measures the direct-call path and does not establish function-pointer ABI conformance. Loop, pointer-call and checksum overhead is included equally, not subtracted. Buffers are hot and aligned; this is not a DRAM bandwidth, cold-cache, multicore or application throughput result. The record parser is a synthetic combined workload; qsort includes initializing its input, and malloc/free includes writing the first and last byte.
What to optimize next
Start with measured losses in frequently used operations, retain the winning cases, and require correctness before promoting a faster path. This ordering reflects this corpus; it is not a claim about every application's CPU profile.
- memmove-overlap: glibc + Nelibc measured 0.64× baseline speed at 1,024 bytes. Keep this case in the comparison while testing short, long, aligned and unaligned inputs.
- memset: Cosmopolitan + Nelibc measured 0.75× baseline speed at 8 bytes. Keep this case in the comparison while testing short, long, aligned and unaligned inputs.
- memchr-absent: glibc + Nelibc measured 0.76× baseline speed at 128 bytes. Keep this case in the comparison while testing short, long, aligned and unaligned inputs.
Decimal range handling. In the separate aligned controls, current Nelibc parsed 1e9999 in 143.13 µs and 1e-9999 in 147.90 µs. Native glibc took 15.28 and 14.92 ns respectively. Both produced the expected binary64 result, end pointer and ERANGE. Compare decimal inputs at all five offsets.
Correctness first: investigate or document the newly failing corpus cases before promoting optimizations: musl / Zig: regression/sigprocmask-internal; Cosmopolitan: functional/popen.
Next evidence: application profiles to weight the cases; more CPUs and working-set sizes; allocator contention and I/O workloads. A single-host microbenchmark cannot establish a globally fastest libc.
Download and reproduce
Run recorded 2026-11-21 UTC. Compiler versions: glibc: gcc (Debian 12.2.0-14+deb12u1) 12.2.0; musl / Zig: clang version 22.1.8; Cosmopolitan: x86_64-unknown-cosmo-cc (GCC) 14.1.0. The musl pair uses Zig's bundled musl; the Cosmopolitan toolchain is 4.0.2. glibc version: glibc 2.36.
Tested Nelibc commit eef2cefc548e6e25760c653ef31154f460bf7690 on Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz with CPU 3 affinity. The public data include raw samples, linked archive hashes and reproduction commands.
The conformance data record every planned public corpus test for both halves of each pair. Cosmopolitan executables use the APE loader. Pinned upstream test source.
Built consumer file sizes
| Profile | Alone bytes | +Nelibc bytes | Link mode |
|---|---|---|---|
| glibc | 22,544 | 682,128 | Dynamic system libc |
| musl / Zig | 1,471,104 | 3,530,936 | Static |
| Cosmopolitan | 1,682,126 | 1,726,670 | Static |
These are not normalized release sizes. The dynamic glibc executable excludes its shared libraries; symbols, debug information, archive granularity and static runtimes affect these files. No footprint winner is claimed.
What works today
| Area | Hybrid builds | Standalone |
|---|---|---|
| Memory, strings, conversions | Broad Nelua implementation | Broad and growing |
| Math | Broad real and complex coverage, incl. x86-64 long double and fenv | Broad; edge cases remain |
| Stdio | Mostly host libc | Partial Nelua implementation |
| Files, processes, threads | Host and Nelua mix | Linux x86-64 base; gaps remain |
| Locale, wide chars, networking | Host and Nelua mix | Partial; resolver APIs remain |
| Terminals, non-local jumps, accounts | Host libc | <termios.h> with pty functions and tcgetpgrp/tcsetpgrp; <setjmp.h> in x86-64 assembly (musl's jmp_buf); <pwd.h>/<grp.h> from /etc files, no NSS; <libgen.h>, <sys/statvfs.h>, <sys/syscall.h>, the rand48 and random generators, execl/execle/execlp, vfork, System V IPC (msg*, sem*, shm*, ftok), popen/pclose, <mntent.h>, mktemp, daemon |
Counts track exported names, not behavioral conformance. "Implemented" means the symbol is present in the archive. See the coverage notes for the methodology and the roadmap for the priority order.
Coverage explorer
Choose a header or archive inventory and a runtime to see which symbols Nelibc supplies.
Download the current inventory and profile data or open the historical musl coverage snapshot.
Build and historical gates
- Requirements
- Nelua and the Cosmopolitan compiler wrapper for the default hybrid build; Zig (
zig cc) for the older profiles. GCC for the GCC profile; TinyCC mob branch for the TinyCC profile. - Build the measured revision
- Use the Nelibc revision and toolchain versions recorded with the comparison. The target
make smoke-cosmousesx86_64-unknown-cosmo-ccfrom Cosmopolitan 4.0.2, checks the full archive link and rejects a glibc dependency. SupplyCOSMOCC=/path/to/cosmocc/bin/x86_64-unknown-cosmo-cc. Compile consumers with Cosmopolitan headers, without-Iinclude. - Older hybrid example
make dogfood-zigbuilds the hybrid archive, compilesexamples/incremental.c, runs it and checks Nelibc'smemcpy,strlen,strchrandstrtolare the ones linked.- Matrices
make smoke-matrix(seven profiles),make dogfood-matrix(four consumers),make host-matrix,make host-bend-hello-zig.- 7 November 2026 gate
- 2026-11-07 on main
1c7240a(branch commitd5f3456): Debian 12, glibc 2.36, GCC 12.2, Zig 0.17.0, Neluadabbd9ef. 159 of 159 targets passed with no warnings: hybrid Zig/glibc, GCC/glibc and Zig/musl, standalone Zig and GCC, freestanding Zig and GCC, the host profile, and musl's libc-test against the hybrid and standalone archives. Until an earlier run that day the gate script had left libc-test out although the repository's gate list includes it; a<limits.h>regression in GCC hybrid builds slipped through that gap and was fixed. - Conformance
- musl's libc-test runs against the gcc and zig hybrid archives with a committed expected-failure list that only shrinks: 112 and 118 after the first slice, 31 (gcc) and 35 (zig) in the recorded 2026-11-07 run, none of them math tests. Slice 2 fixed strftime, fnmatch, exact
%La, the TZif reader's stack use andmalloc_usable_size; the math slice ported musl's exp, pow, log, trigonometric, gamma and Bessel code with its exception-flag discipline, which cleared 76 math tests. A follow-up fixed the last seven: the sign offmawith a zero addend,fmafrounding and underflow in the subnormal range, the sign ofmodfl's fraction, and musl ports oferfl,erfclandexp10l.printfnow formats every long double exactly:%Lf,%Leand%Lgwrite the full decimal expansion of the 80-bit value and round half to even, checked against glibc on 28 cases includingLDBL_MAXin all 4,940 characters. - Standalone conformance
- libc-test also runs against the standalone archive, where Nelibc is the whole C library: Nelibc's headers only, its own
_start, libc-test's own runner with the 100 KiB stack limit. The first run passed 255 of 343 tests with GCC; after the fixes it led to (<limits.h>,<inttypes.h>,<langinfo.h>,<search.h>and<regex.h>(nebox's Pike VM engine behind the POSIX interface) for standalone, static constructors and destructors, scanf%nandungetcpushback, cancellation points and PI mutex relock,ftelloon append streams,sem_openreuse,pthread_create'sEAGAIN, exit after the lastpthread_exit) 300 pass with GCC and 301 with Zig, with no timeouts; with<pwd.h>/<grp.h>,<setjmp.h>and a batch of small POSIX families since, 326 pass with GCC and 328 with Zig; withiconv(UTF-8/16/32, UCS-2/4, the ISO-8859 and Windows code pages, KOI8, CP437/850, musl's*replacement),shm_open,dn_expandand a GCC<tgmath.h>on top, 332 pass with GCC and 333 with Zig (all 11 and 10 failures expected and listed; one of GCC's is a libc-testmainwithout areturn).mktimenow honours atm_isdstthat contradicts the date, as glibc and musl do, a fix found through nebox'sdate -d '14 days ago'. Every math test that builds passes. The rest is a written map of what is missing (dl*,crypt,wordexp, ...) and of what is still open (aposix_spawnpnull-envpdivergence, destroying a locked robust mutex), in docs/libc-test.md. - CPU baseline
- Zig builds default to
-mcpu=x86_64; override withZIGFLAGS='-mcpu=x86_64_v3'on purpose.