4 ms·
My company has its code basically split in half between Python and Rust. Our Python code uses mypy pretty aggressively. The iteration speed difference is... dra
by staticassertion 4y ago
My company has its code basically split in half between Python and Rust. Our Python code uses mypy pretty aggressively. The iteration speed difference is... drastic. Rust far outshines Python in terms of our ability to get something done, maintain it, and iterate on it over time.
- muglug 4y agoThat's great for you and your team, but looking at https://github.com/grapl-security/grapl https://github.com/grapl-security/grapl it seems like your needs are pretty different from most web developers.
- staticassertion 4y agoHow so? We use many of the crates listed on the linked page - sqlx, rusoto, actix-web, tower/tonic, etc.
- muglug 4y agoYeah, but the thing you're building is quite a bit more complex than the average consumer-focussed website.
- staticassertion 4y agoI guess, but if you're just building some basic CRUD app that's never going to change, why would iteration speed matter anyway?
- muglug 4y agoIt's more a CRUD app that has many features added in the first six months, and fewer features added thereafter, and then a few months go by and a new developer takes over and has to figure out how to add yet another feature. That model favours easy-to-google frameworks with wide ecosystems.
- fartcannon 4y agoDid you mean to write that python beats rust? I find it hard to believe Rust is faster to 'get something done' than Python. Happy to be proven wrong, of course.
- staticassertion 4y agoNope, it's written correctly as-is. Probably the "time to tests pass" is about equal, but the iteration and maintenance is far better in Rust.
- melissalobos 4y ago> but the iteration... is far better in Rust That is something I would find hard to believe, if you mean iteration of changes. I have coordinated a few rust rewrites, and at least seeing engineers live programming, it takes far far longer to change and compile Rust code than python. Could you talk more about your company's process or how you mean?
- staticassertion 4y agoThe time it takes to run `cargo check` is nothing compared to dealing with bugs, terrible tooling, weak errors, etc. All of those areas have been radically better with Rust. As an example, type errors in Rust are radically better than mypy, it's no competition. In general rust's type system is just way better, we have to use Any all over the place because mypy can't even handle a Json type (no recursive types at all). There's nothing that Python really does better in terms of iteration that I can think of. Obviously you don't have to compile code, but `cargo check` is seconds, that is not the bottleneck. We use hypothesis in Python and quickcheck in Rust, cargo is way better than pip, working with loosely typed data is about the same in Rust, maybe a bit better, and working with strictly typed data is wayyyy better. The tooling for working with crates, having an actual lockfile, higher quality libraries, etc. It just all makes Rust more productive. We've run into maybe one rust footgun, which is that binding to _ drops the value immediately. We've run into so many Python footguns, like, did you know that in Python if you want to do circular imports you need to put your imports at the bottom of the file? Or use absolute imports everywhere? Neither of which seem to work 100% of the time by the way, something that makes writing graph data structures quite cumbersome. The other day we ran into a stray comma turning a value into a tuple. The papercuts and footguns across the tooling and language just add up really fast and basically don't exist in Rust. I don't know how people get stuck on the borrow checker, frankly. It's one thing if you're very new to the language, but within weeks it should be very simple to avoid those errors. I maybe hit a "fuck, what" borrow checker issue once a year, in which case I hit up the Discord, they fix it, and I file an issue with rustc so that the error message will get improved. This is based on about 7 years of Rust and Python experience, with 6 years of professional experience in Python and 3 in Rust.
- bobbylarrybobby 4y agoMy impression has been that python is easier to iterate on over the course of a week, while Rust is easier to iterate on over the course of a year.