• zack_overflow Profile Picture

    zack (in SF) @zack_overflow

    3 years ago

    When Zig is safer and faster than Rust: I recently wanted to compare Rust vs Zig, so I wrote a garbage collected bytecode interpreter in both languages It turned out that the Zig version was actually faster AND safer than the Rust version How come?

    23 78 741 182K 219
  • zack_overflow Profile Picture

    zack (in SF) @zack_overflow

    3 years ago

    Garbage collection is a hard problem to solve in Rust, it fundamentally is something that doesn't play nicely with the borrow checker. It's possible to write one in safe Rust, typically using refcounting or arenas+handles, but those seem to be slower than a typical mark/sweep gc

    2 3 78 16K 3
  • zack_overflow Profile Picture

    zack (in SF) @zack_overflow

    3 years ago

    So to compete with Zig (and also for for fun), I decided to practice the dark arts and use unsafe Rust. It turns out that unsafe Rust is hard. There are a lot of complicated rules about undefined behaviour. It's super easy to violate them and cause subtle bugs

    2 4 85 15K 2
  • zack_overflow Profile Picture

    zack (in SF) @zack_overflow

    3 years ago

    In the end, the Zig version was not only safer and faster than the Rust version, but also much easier to write. I talk more in depth on why in my new blog post: zackoverflow.dev/writing/unsafe…

    4 11 135 16K 24
  • zack_overflow Profile Picture

    zack (in SF) @zack_overflow

    3 years ago

    Fundamentally, Zig is a language that understands you are going to do memory-unsafe things and is designed around making that experience better and less error-prone.

    1 4 116 14K 2
  • zack_overflow Profile Picture

    zack (in SF) @zack_overflow

    3 years ago

    Rust's language design is optimized around making it so you never need to do memory-unsafe things. I had a difficult time because almost everything I was doing was breaking the borrow checker's rules and treading in territory Rust wasn't designed for

    1 4 84 14K 2
  • Download Image
    • Privacy
    • Term and Conditions
    • About
    • Contact Us
    • TwStalker is not affiliated with X™. All Rights Reserved. 2024 www.instalker.org

    twitter web viewer x profile viewer bayigram.com instagram takipçi satın al instagram takipçi hilesi twitter takipçi satın al tiktok takipçi satın al tiktok beğeni satın al tiktok izlenme satın al beğeni satın al instagram beğeni satın al youtube abone satın al youtube izlenme satın al sosyalgram takipçi satın al instagram ücretsiz takipçi twitter takipçi satın al tiktok takipçi satın al tiktok beğeni satın al tiktok izlenme satın al beğeni satın al instagram beğeni satın al youtube abone satın al youtube izlenme satın al metin2 metin2 wiki metin2 ep metin2 dragon coins metin2 forum metin2 board popigram instagram takipçi satın al takipçi hilesi twitter takipçi satın al tiktok takipçi satın al tiktok beğeni satın al tiktok izlenme satın al beğeni satın al instagram beğeni satın al youtube abone satın al youtube izlenme satın al buyfans buy instagram followers buy instagram likes buy instagram views buy tiktok followers buy tiktok likes buy tiktok views buy twitter followers buy telegram members Buy Youtube Subscribers Buy Youtube Views Buy Youtube Likes forstalk postegro web postegro x profile viewer