Live data from Hacker News

Zlib-rs is faster than C

trifectatech.org

491–492 of 492 posts

Re: Zlib-rs is faster than C

#491

Earlier quoted context omitted.

These seem to be beta features. But in any case it seems like its just doing some number of asserts to validate some preconditions. However, even at runtime it can't do anything to say if (excuse the C pseudocode) *(uint32_t*)0x1C00 = 0xFE is a valid memory operations. On some systems, in some cases it might be.

> These seem to be beta features What? Where did you get that impression? > But in any case it seems like its just doing some number of asserts to validate some preconditions Yeah, like C code normally would, just in the STD in this case.

> What? Where did you get that impression?

https://doc.rust-lang.org/beta/

> Yeah, like C code normally would, just in the STD in this case.

Yes, in that manual checks are still needed. My point is unsafe code in rust is nowhere near safe and cannot be considered as safe without extensive analysis, no matter the language features used.

Re: Zlib-rs is faster than C

#492
post #359

Earlier quoted context omitted.

> fundamental impediment This is an interesting word. I wonder why no one has written high performance library code in assembly yet at this point?

> I wonder why no one has written high performance library code in assembly yet at this point? What do you mean by that? There is plenty of hand-rolled assembly in low-level libraries, whether you look at OpenBLAS (17%), GMP (36%), BoringSSL (25%), WolfSSL (14%) -- all of these numbers are based on looking at Github's language breakdown (which is measured on a per-file basis, so doesn't count inline asm or heavy use…

And? why isn't everyone writing every softawre in assembly if there's no "fundamental impedement" to doing so.

The answer is that its more ergonomic and easier to reason about. So while you can TECHNICALLY have "algebraic data types" in C i.e. "its just a tagged union so whats the big deal?" I prefer to use them in Rust than C, for whatever unknown reason...

I also don't want to spend my brain cells thinking about pointer provenance and which void* aliases with each other. I would rather spend it on something else, thank you very much.

Post reply on HN