Rewriting Kawipiko in Rust #13
Replies: 2 comments
-
I see why Rust would improve kawipiko by skipping the garbage collector altogether and manually managing the memory as well as getting a peek into the low level parts of hardware. Although, I am not aware of the specifics, I support this change. However, I do want to point out that one of the features of kawipiko is security and limiting syscalls. According to this article by Drew DeVault, Rust has 123 syscalls and 21 unique syscalls for "Hello World". Compared to Go and Crystal, Rust has 20% less syscalls. Which makes Zig the program with the least syscalls for "Hello World" at two syscalls for the example matching assembly directly. I also want to add that I theorize that Zig has better C++/C interop and since some libraries are drastically faster written in C++ like simdjson (although this one isn't of use to this project in particular; an http parser with SIMD instructions would be), it is worth considering C and C++ interop. Though, things like CDB64 and CDB libraries might need to be implemented as CDB isn't implemented in Zig and CDB64 hasn't been implemented in both Zig and Rust. |
Beta Was this translation helpful? Give feedback.
-
Regarding C/C++ interoperability, Rust has perhaps just as good support as does Zig. Unfortunately, at the moment the "big money" (i.e. AWS, Microsoft, etc.) is spent on Rust and not on Zig... However, at least for Kawipiko I intend to keep everything as Rust-native as possible (i.e. implemented in native Rust, not C/C++, etc.) |
Beta Was this translation helpful? Give feedback.
-
A large part of the development effort that went into Kawipiko was to profile the runtime so as to eliminate as much as possible the heap allocations or hidden copies, and thus the Go garbage-collector. This meant doing lot's of unsafe tricks (casting strings into byte slices, etc.) and a lot more hacks (like poking into the internals of the Go HTTP implementation).
This is not sustainable, and thus I would like (if time permits) to re-implement Kawipiko in Rust.
What would be the advantages:
Any comments on this decision?
Beta Was this translation helpful? Give feedback.
All reactions