Live data from Hacker News

Comparison of C/POSIX standard library implementations for Linux

etalabs.net

11–20 of 58 posts

Re: Comparison of C/POSIX standard library implementations for Linux

#11

It really ought to lead with the license of each library. I was considering dietlibc until I got to the bottom - GPLv2. I am a GPL apologist and even I can appreciate that this is a nonstarter; even GNU's libc is only LGPL!

musl seems to have displaced dietLibc. Much more complete yet fairly small and light.

Re: Comparison of C/POSIX standard library implementations for Linux

#12

Fun libc comparison by the author of musl. My getaway is: glibc is bloated but fast. Quite unexpected combination. Am I right?

A lot of the “slowness” of MUSL is the default allocator. It can be swapped out.

For example, Chimera Linux uses MUSL with mimalloc and it is quite snappy.

Re: Comparison of C/POSIX standard library implementations for Linux

#13
My own perf comparison: when I switched from Fil-C running on my system’s libc (recent glibc) for yololand to my own build of musl, I got a 1-2% perf regression. My best guess is that it’s because glibc’s memcpy/memmove/memset are better. Couldn’t have been the allocator since Fil-C’s runtime has its own allocator.

Re: Comparison of C/POSIX standard library implementations for Linux

#16

Earlier quoted context omitted.

In case of glibc I think what you said is orthogonal to its bloat. Yes, it has complex implementations but since they are for a good reason I'd hardly call them bloat. Independently from that glibc implements a lot of stuff that could be considered bloat: - Extensive internationalization support - Extensive backward compatibility - Support for numerous architectures and platforms - Comprehensive implementations of op…

Ok, fair points, although internationalization seems like a reasonable thing to include at first glance. Is there a fork of glibc that strips ancient or bizarre platforms?

It's called glibc. Essentially all that "bloat" is conditionally compiled, if your target isn't an ancient or bizarre platform it won't get included in the runtime.

Re: Comparison of C/POSIX standard library implementations for Linux

#17

Earlier quoted context omitted.

Ok, fair points, although internationalization seems like a reasonable thing to include at first glance. Is there a fork of glibc that strips ancient or bizarre platforms?

It's called glibc. Essentially all that "bloat" is conditionally compiled, if your target isn't an ancient or bizarre platform it won't get included in the runtime.

That’s mostly true, but not quite. For instance, suppose you aim to support all of 32/64-bit and little/big-endian. You’ll likely end up factoring straightforward math operations out into standalone functions. Granted, those will probably get inlined, but it may mean your structure is more abstracted than it would be otherwise. Just supporting the options has implications.

That’s not the strongest example. I just meant it to be illustrative of the idea.

Re: Comparison of C/POSIX standard library implementations for Linux

#18
post #10

Earlier quoted context omitted.

Ok, fair points, although internationalization seems like a reasonable thing to include at first glance. Is there a fork of glibc that strips ancient or bizarre platforms?

What problem are you trying to solve? glibc works just fine for most use cases. If you have some niche requirements, you have alternative libraries you can use (listed in the article). Forking glibc in the way you describe is literally pointless

Nothing really. I was just curious and this isn’t something I know much about, but would like to learn more of.

Re: Comparison of C/POSIX standard library implementations for Linux

#19

My own perf comparison: when I switched from Fil-C running on my system’s libc (recent glibc) for yololand to my own build of musl, I got a 1-2% perf regression. My best guess is that it’s because glibc’s memcpy/memmove/memset are better. Couldn’t have been the allocator since Fil-C’s runtime has its own allocator.

Interesting! Will you stick around with the musl build? And if so, why?
Post reply on HN