8 ms·
I have fully switched over to Rust to do my web backend's. I use Nickel.rs and it has worked great. The code is very succinct and fast. The only downside I have
by dkhenry 11y ago
I have fully switched over to Rust to do my web backend's. I use Nickel.rs and it has worked great. The code is very succinct and fast. The only downside I have found to this is that there is no "Hot Reload" which I had with Flask(Python) and Play(Scala).
As the ecosystem grows I only expect it to get better.
- zatkin 11y agoNickle.rs is at http://nickel.rs/ http://nickel.rs/
- shepmaster 11y agoIt's also spelled "Nickel.rs", as shown in the link ^_^
- zatkin 11y agoOops, my mistake.
- vkjv 11y agoWhat are the compile times like? Is a simple watch script with a re-compile sufficient?
- steveklabnik 11y agoNot the parent, but they've gotten faster every release, so if you've tried Rust in the past, your previous experience would be wrong. We're in the middle of a big refactoring of the compiler that will eventually enable even more gains. I'm confident rustc will only get faster in the future.
- kibwen 11y agoYou can't go evangelizing about compile times without even mentioning incremental recompilation. :P https://github.com/rust-lang/rfcs/pull/1298 https://github.com/rust-lang/rfcs/pull/1298
- untothebreach 11y agoUnless you are on windows, you can try cargo-watch[1] to re-compile and run your code when the source changes. 1: https://github.com/passcod/cargo-watch https://github.com/passcod/cargo-watch
- dkhenry 11y agoI will have to give that a try. Its amazing how much hot reloading speeds up development.
- mixmastamyk 11y agosudo apt-get install inotify-tools and a short shell script.
- Keats 11y agoAh that's interesting! Can you talk a bit more about the kind of project you're doing ?
- dkhenry 11y agoMy current project is an interface to get detailed application performance statistics off a clustered system. So it connects to a local database and has a configurable list of system checks that it can run. Then it has a defined API that is consumed by the Polymer front end. Rust is nice in that I can do all sorts of great clustering and network programming, and then have a thread that exposes the WebUI and all of that is wrapped up in a single binary. That I can just push to systems and execute.
- Keats 11y agoIt would definitely be interesting if you have time to push a sample project somewhere to see how it looks when it's someone that knows what they are doing.
- Touche 11y agoWhat was behind your decision to pick Rust? My understanding is that Rust is meant as replacement for C++ in places where C++ performance is needed (browsers, systems programming (maybe)), etc. A web server does not fall into that category, so why did you pick it?
- jerf 11y ago"A web server does not fall into that category, so why did you pick it?" That's too categorical a statement. It depends on a lot of things. Sure, there's a place in the world for PHP pages that take two or three full seconds to render, but it doesn't matter because they're doing something useful and don't get hit a thousand times per second. There's also a place for things that render in under a millisecond because they're getting hit at an incredible rate, and if they also have some sort of interdependencies then Rust can make a lot of sense. Plus as I've said before, the whole "you're stuck in IO anyhow so who cares how fast the render code runs" dogma has sometimes gone too far. (I know you didn't say anything about that, but I'm guessing based on experience it's what lies behind your point.) My experience in switching from slow languages to fast languages, even doing the same IO, is that you do tend to see real performance gains unless your page was absolutely trivial. Slow languages really are slow in practice.
- jurre 11y ago> PHP pages that take two or three full seconds to render I don't use php personally, but most of my rails apps render full pages in under 100ms. I'd imagine php performance to be at least on-par with a full rails app.
- jerf 11y agoI'm thinking Wordpress, or bespoke status pages for internal apps. Of course you can get a PHP page out in under a millisecond if you try hard enough, but it's often not used in that sort of place. (And it often is, but that still doesn't mean it often isn't.) Rails, for that matter, is known for being easy to produce multi-second pages too. Slow languages are slow in practice, too.
- the_mitsuhiko 11y agoI have some ideas for making hot reload work for web dev i just did not have the time yet :(
- markus2012 11y agoI have also switched to Rust for backend work. I'm using Iron instead of Nickel. Not sure who will become more popular over time... Because of the language (no null, bounds checking, option/result types, etc.) and borrow checker I find I rarely have to 'hot reload' or even test my code. I realize that sounds surprising. I'm not doing any HTML templating in Rust - that's better done in JavaScript on the client - so I don't have the edit/compile/test cycle for every tweak to the UI.