4 ms·
Last year I ported a virtio-host network driver written in Rust, entirely changing its backend, interrupt mechanism and converting it from a library to a standa
by nneonneo 1y ago
Last year I ported a virtio-host network driver written in Rust, entirely changing its backend, interrupt mechanism and converting it from a library to a standalone process. This is a complex program that handles low-level memory mappings, VM interrupts, network sockets, multithreading, etc.
What’s remarkable is that (a) I have very little Rust experience overall (mostly a Python programmer), (b) very little virtio experience, and (c) essentially no experience working with any of the libraries involved. Yet, I pulled off the refactor inside of a week, because by the time the project actually compiled, it worked perfectly (with one minor Drop-related bug that was easily found and fixed).
This was aided by libraries that went out of their way to make sure you couldn’t hold them wrong, and it shows.
- mmastrac 1y agoI've been writing Rust code for a while and generally if it compiles, it works. There are occasional deadlocks and higher-level ordering issues from time-to-time, but modulo bugs, the compiler succeeding generally means it'll run a decent amount of your project.
- jabwd 1y agoThough my code complexity is far FAR from what you've been writing it has been a similar experience for me. There are a few footguns and a bug in chrono I still have to find the energy to report or fix; which has been causing a bi-yearly issue, but apart from that happy lil programmer.
- burntsushi 1y agoI would be curious to know if you've looked at `jiff`. Does it resolve your bug/footgun issues with chrono?
- shark1 1y agoReviews like yours are increasing my interested towards Rust. Apparently the tools and ecosystem are great, build on solid concepts and foundation.
- baq 1y agoRust has 3 major issues: - compile times - compile times - long compile times It isn't that big of a deal in small projects, but if you pull dependencies or have a lot of code you need to think about compilation units upfront.
- winter_blue 1y agoHow is Rust in terms of incremental compile time? Is incrementally recompiling on file in a large project quick? Hopefully link times aren't that bad. One thing I like about the JVM is hot code reloading. Most of the time, changes inside a method/function takes effect immediately with hot code reloading.
- chiffaa 1y agoLink times are the worst part but solveable with mold[1]/sold. Incremental compilations are usually an order of magnitude (or even two) faster than clean compiles but tbh that can still feel slow. Helped by using something like sccache[2] or even cranelift[3] when debugging. Still not as fast as having a hot-reloadable language but it gets you to a relatively pleasant speed still IME [1] https://github.com/rui314/mold https://github.com/rui314/mold [2] https://github.com/mozilla/sccache https://github.com/mozilla/sccache [3] https://github.com/rust-lang/rustc_codegen_cranelift https://github.com/rust-lang/rustc_codegen_cranelift
- mmastrac 1y agoI've never been successful in getting sccache to really speed up projects, but then again only release builds have _really_ been impossible for me, and that's only when I was working on Deno which was absolutely massive.
- chiffaa 1y agosccache sped up my clean compiles by 2x on some projects, but it's a very YMMV solution most of the time
- AlanYx 1y agoIt's a lot like Haskell in that respect. Once you get something to compile, it tends to work more often than not.