←back to thread

Zlib-rs is faster than C

(trifectatech.org)
341 points dochtman | 1 comments | | HN request time: 1.082s | source
Show context
kahlonel ◴[] No.43381785[source]
You mean the implementation is faster than the one in C. Because nothing is “faster than C”.
replies(11): >>43381811 #>>43381892 #>>43382209 #>>43382286 #>>43382342 #>>43382418 #>>43382745 #>>43383389 #>>43383690 #>>43384451 #>>43392826 #
1. kllrnohj ◴[] No.43382745[source]
It is quite easy for C++ and Rust to both be faster than C in things larger than toy projects. C is hardly a panacea of efficiency, and the language makes useful things very hard to do efficiently.

You can contort C to trick it into being fast[1], but it quickly becomes an unmaintainable nightmare so almost nobody does.

1: eg, correct use of restrict, manually creating move semantics, manually creating small string optimizations, etc...