• 0 Posts
  • 20 Comments
Joined 2 years ago
cake
Cake day: June 16th, 2023

help-circle










  • My brain goblin is a big fan of performance. Recently I reviewed a teammate’s code. It was a small 100ish line PR and he calls the same function twice in a row with a tiny variation. My brain goblin went “you could consolidate these into one call”, “since it’s only one call you could inline it”.

    A couple hours later when he came to ask me what I’m smoking I realised my proposed solution had more LoC and was more complex to read. If we needed better performance, step 1 should’ve been to offload this task to an API that wasn’t made with python. Not to mention the next thing this API does is string manipulation and then write to file.




  • If you want inheritance you can add structs as parameters of other structs. This will also allow them to use impl functions for that struct.

    As far as I understand it Arc<> is just the Async version of RC<>.

    I’m not entirely sure about Box<> and a lot of its API’s are still unstable but I believe it’s primarily used as an owner for unsafe things.


  • ez! I work for a company that builds a SaaS end to end product.

    Myself and my coworker were asked to build exports for a single client. They were json exports. To start the client would take weeks/months to get back to us, their spec was very vague and their exports had some really complex logic to sort data. We’d been going back and forth with them for almost a year when they said we should give it to them “as is”. They now are the proud owners of 2 complex broken exporters.



  • Solemarc@lemmy.worldtoRust@programming.devLearning Rust
    link
    fedilink
    arrow-up
    10
    ·
    edit-2
    2 years ago

    Aside from the usual recommendations of: The Rust Book and Rustlings.

    I’d also recommend you try porting things you’ve made previously into rust. The amount of times I’ve ported something over and realised I could’ve done it better originally is too damn high.