Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Go and Rust won't help there, but Zig might.


I can understand that Go has a GC so it (might) be slower. But wouldn't Rust and Zig have about the same performance?


Go is slower because it optimizes for compile time.

Rust is slower (usually) because Rust does not revolve around making the most use of the hardware it has.

both are fine choices; nothing wrong with either direction.

Zig performs very well by default because it was designed to be efficient and fast from the start, without compromise. it has memory safety, too, but in a way that few seem to understand, myself included, so it's difficult for me to describe with my rudimentary understanding.


Maybe if you use nostd. I evaluated a bunch of Rust libraries for some server software, but I could not use any of them because they pervasively assume that it is ok to make syscalls to allocate memory. If you'd like to write software that makes few syscalls in the steady state, you can do it in rust, but you can't use libraries. Or String or Vec, I guess.


Why is memory allocation via syscalls bad? I get it for embedded (which was mentioned above so perhaps that's what this targets), but I kind of assumed malloc was a syscall underneath on an actual OS and that was fine.


Actually, you don't need to run any functions to cause a context switch. For example, at the very lowest level, even trying to access a memory page that is presently in physical memory but does not have entry in TLB causes CPU to interrupt to OS to ask for mapping.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: