[HN Gopher] One Year of Rust in Production
       ___________________________________________________________________
        
       One Year of Rust in Production
        
       Author : skwee357
       Score  : 10 points
       Date   : 2024-09-22 10:23 UTC (12 hours ago)
        
 (HTM) web link (yieldcode.blog)
 (TXT) w3m dump (yieldcode.blog)
        
       | throwup238 wrote:
       | _> Compile time is still PITA_
       | 
       | This is Rust's Achilles heel and has been since almost day one.
       | Once a project is at a nontrivial scale, it really starts to
       | weight it down. I'm working on a Rust/C++/QT QML desktop app and
       | I've spent the last week refactoring my crates/libraries so I can
       | split them off as shared libraries that can be built
       | independently, otherwise even incremental builds can take
       | minutes. Thankfully there are some crates to make a stable ABI
       | and dynamic reload.
       | 
       |  _> LLMs rarely help with a proper solution, as most of the
       | packages are kind of niche._
       | 
       | This has also bitten me quite a bit but at the same time, I've
       | been impressed with what Claude 3.5 and o1-preview have been able
       | to do with Rust even with niche libraries like cxx-qt - a
       | relatively new library with little in the training data. A lot of
       | stuff like writing Rust implementations of QAbstractListModel
       | works really well when given the right context (like an example
       | implementation of another list model).
       | 
       | LLMs have also been a boon for writing macros, both macro_rules
       | and proc macros.
        
         | dietr1ch wrote:
         | Code generation isn't the fastest, but you can iterate with
         | `cargo check`
        
         | iTokio wrote:
         | There is a subset of Rust that compiles fast, but it requires
         | to avoid serde and crates that depends on syn, quote, proc-
         | macro...
         | 
         | The issue is that macros and generics can generate tons of code
         | under the hood.
         | 
         | Unfortunately some major parts of the rust ecosystem like
         | serialization and async frameworks are dependent on these
         | features..
        
       | jksmith wrote:
       | # If it compiles, it runs # And when it runs, it's very stable
       | 
       | Modula-2 40 years ago. The ship had strong bones to build upon a
       | long time ago, but alas, C. The tyranny of the masses.
        
       | dicytea wrote:
       | > sqlx -- a compile time, type safe SQL wrapper that runs your
       | queries against a real DB
       | 
       | SQLx seems like end game stuff at first glance, but after trying
       | it out for a while I eventually decided that it wasn't for me.
       | Writing dynamic/conditional queries just sucks and there isn't
       | any good solution. On the DX side, completion,
       | formatting/linting, highlighting is also non-existent (at least
       | on VS Code).
       | 
       | I eventually settled on [Diesel][0] (a query builder-ish ORM) and
       | I'm loving it so far. Its [performance][1] crushes every other
       | SQL libraries, including SQLx (very counter-intuitive, huh?).
       | It's technically an ORM, but the query builder is very flexible
       | and you can also extend it with your own traits. It got its
       | warts, but it's the most tolerable SQL rust library I've found so
       | far.
       | 
       | [0]: https://diesel.rs
       | 
       | [1]: https://github.com/diesel-rs/metrics
        
       ___________________________________________________________________
       (page generated 2024-09-22 23:02 UTC)