Protty

1.5K posts

Protty banner
Protty

Protty

@kingprotty

System optimizer + concurrency geek.

Katılım Ağustos 2019
77 Takip Edilen3.2K Takipçiler
Protty
Protty@kingprotty·
@__morse @nevgeniev @croloris Thinking for the lang itself rather than stdlib allocators. That pattern would need to indicate when ownership moves to know who destructs; for f(x: T) is x the owner? a non-destructive copy? what about f(x: *T) like in deinit() pattern - owner or mut-borrow?
English
0
0
2
40
Loris Cro ⚡
Loris Cro ⚡@croloris·
I feel compelled to give space also to disagreeing opinions. If this (totally based on real data) graphic makes you lose faith in the future of Zig, I strongly encourage you to do what you think is best for you and stop using Zig, no hard feelings :^)
Proton@ProgenticEngine

@croloris

English
39
15
278
28.8K
Protty
Protty@kingprotty·
@nevgeniev @croloris @__morse Dont lifetimes require a concept of ownership (for the shared xor mut aspect), then special casing for interior mutability (mutation thru shared ref : UnsafeCell)? Or can it be done simpler?
English
1
0
2
346
nevgeniev
nevgeniev@nevgeniev·
@croloris @__morse That's an opportunity loss :((. Imo it's super valuable and doesn't complicate the language. And no rust has no linear types
English
2
0
2
487
Protty
Protty@kingprotty·
@ForrestPKnight @ippsav comptime isnt "rough" without traits or interfaces. Duck typing is only through `anytype`, which is optional. An error in a generic body will return a stack trace you can jump to & read. Other points are zsf leadership, but this reads as if u glanced at the lang but never used it
English
0
0
2
72
Forrest Knight
Forrest Knight@ForrestPKnight·
Most of the Zig "hate" I've seen is just fun n' games. But even so, having an anti-Zig stance is completely understandable. - still in beta after 10 years, unstable - break code almost every release (wonder if they'll rewrite I/O again, again) - anti-ai policy regardless of code quality - good PRs blocked due to that policy - moving off GitHub with a holier-than-thou attitude... while the engineering reasons were understandable, the political bookending was nonsense - call GitHub engineers monkeys and losers then backtrack when you receive backlash - their whole comptime duck typing thing is rough. no traits, no interfaces, errors buried in generic bodies. good luck to ya. Zig's largest user has to fork Zig to ship at a reasonable pace, and when they try to push a change with 4x faster debug compilation, Zig doesn't accept it. So let's not pretend the Zig "hate" is unwarranted. There are plenty of reasons for it.
Mitchell Hashimoto@mitchellh

It isn't unexpected that the focus of the Bun Rust rewrite is on the anti-Zig side more than anything, since the internet loves to hate. What is unexpected and unfortunate is that leadership within Bun hasn't tried to steer the conversation away from that at all. There are so many positive and interesting takeaways from this and I'm not really seeing any of them pushed as the primary message. A positive thing that hasn't been talked about at all is how far Bun came thanks to Zig. And even if you dump it now, its meaningful for how good Zig was to even build a product to this point and impact by any metric. I would've loved to see anyone in leadership say this. On the interesting side is how fungible programming languages are nowadays. Programming languages used to be LOCK IN, and they're increasingly not so. You think the Bun rewrite in Rust is good for Rust? Bun has shown they can be in probably any language they want in roughly a week or two. Rust is expendable. Its useful until its not then it can be thrown out. That's interesting! There's been a lot of talk about memory safety and no doubt Rust provides more guarantees than Zig. But I'd love to see a better analysis of why Bun in particular suffered so much rather than take the language-blame path. How could engineering as a practice been more rigorous to prevent this? What were the largest sources of crashes other programs should watch out for? How does Rust prevent them? How could Zig theoretically prevent them? That's interesting. I know the official blog post hasn't come out yet from Bun. But they're smart enough to know that that PR would stir up controversy the moment it opened, or they should've been. And plenty in the company have been tweeting and writing about it. Its somewhat telling to me in various dimensions what they chose to talk about first. I tend to think I'm pretty good at corporate PR/comms (especially when it comes to developer audiences) and I think appealing to the negative is never the right long term strategy; it does work to get short term eyes though.

English
54
23
575
78.7K
Peter Veentjer
Peter Veentjer@PeterVeentjer·
Claude Code is an amazing tool, but it isn't particularly strong with memory ordering. I needed to point out all kinds of mistakes in its reasoning to keep it on track.
English
1
0
3
851
Protty
Protty@kingprotty·
@eatonphil for disk, dispatching it off control plane is main benefit, ideally low cost dispatch: SQPOLL or ringbuf->another thread for network, idk. Less syscalls, but is that better? Registered buffers vs mlock? Needs bench. Usually u just skip as much of kernel as u can instead e.g. XDP
English
1
0
2
448
Phil Eaton
Phil Eaton@eatonphil·
Where do you think io_uring will do better than epoll or AIO and where will it not (including having no noticeable benefit, not necessarily being worse)? For disk and for network io, where relevant
English
10
0
32
6.9K
Protty retweetledi
Phil Eaton
Phil Eaton@eatonphil·
Whatever your transactional database is, help me understand your use of it. This survey is run by @theconsensusdev, independent of any database or vendor. RT or pass along to industry peers for broader representation forms.gle/fqjQsezWsztxvY…
Phil Eaton tweet media
English
1
11
15
4.8K
Protty
Protty@kingprotty·
@stephc_int13 I'm a conditional Rust promoter. Not reviewing what the LLMs are writing falls into the first category, so that's fair.
English
0
0
0
49
Stéphane Cocquereaumont
Stéphane Cocquereaumont@stephc_int13·
@kingprotty I am not a Rust fan, quite the opposite, but with the widespread use of vibe coding, I understand the need for safeguards. It is too much work to audit everthing the LLM is writing.
English
1
0
1
77
Protty
Protty@kingprotty·
If you're not doing deliberate low-level code, can't seem to stop getting memory errors, or work on systems projects with a team of varying skill levels, Rust (or any lang with Refinement types + an optimizing compiler) is probably the better tool, I'd assume.
zack@zack_overflow

Unfortunately, I don't use Zig now. Every 1.5-5x human DX productivity boost from Zig features is eclipsed by the 100x boost from coding agents writing Rust: Allocator interface: This is my favorite Zig feature, you feel so galaxy brain using a specialized allocator to optimize a code path (e.g. arena, stack fallback etc). The problem in Rust used to be that there was no Allocator interface equivalent and if you wanted a Vec that used a custom allocator you literally had to copy+paste the std version and modify it to use it (this is what Bumpalo did, look at the source). For a long while now there has been an Allocator trait in nightly, and it seems to be good now. Because it is a trait it is static dispatch, vs Zig's which is based on a vtable. Unlike Zig there isn't a community-wide convention of designing data structures to be parametric based on the allocator, but AI changes the game and makes it trivially to copy paste code and change that. I find it works well enough for my use-case. Arbitrary bit width integers + packed structs: Another beloved Zig feature of mine. It makes it so easy to do DOD-style CPU cache optimizations and stuff like tagged pointers, NaN boxing, etc. and even made bitflags really easy to make. You could always do this in Rust or any systems programming language but it was really ugly/unergonomic. The least worst option was using some crate like bitfield/bitflags which both rely on proc macro magic to work. Now, with coding agents I literally do not care how annoying it is to write the code by hand. Comptime: This is Zig's flashiest feature, no other programming language except maybe for obscure dependent-types langs have compile time evaluation as nice as Zig's. I thought I would miss it a lot, but I actually don't. For me, 95% of comptime usage is to create Zig's version of generic data structures with parametric types. Rust has a better designed type system IMO (see next section). In the remaining 5% of cases, not having comptime sucks. The only reliable way to reach an equivalent is through codegen. I'm making a game right now, and I have hardcoded hitbox geometry data generated from a tool that I want to bake into a data structure. Without comptime, I have to get Claude to write a script that generates the Rust file. However, I don't find myself needing compile time evaluation that much anyway. Rust's type system: I think I'd rather trade having comptime for Rust's better-designed type system, especially for bounded polymorphism (traits/typeclasses). Trying to do the equivalent in Zig is a nightmare. Also, I think that Rust's type system allows you to enforce more variants and prevent coding agents from making common mistakes. In my game I use the euclid crate which essentially allows you to not mix up coordinate spaces (very common problem in graphics programming) by creating specialized types for each coordinate space (e.g. Point or Point) Not having to deal with memory issues: With coding agents allowing 100x more code to be written, this also means you need to scrutinize 100x more Zig code for memory issues. Without formal verification, the surface area of the search space to enumerate to find bugs is just so much larger now. With the magnitude of code being generated now, Rust is even more attractive. Rust's tradeoff was always that it hinders developer productivity especially if you are unfamiliar with borrow checker, but this simply does not matter with coding agents anymore. And if you do use unsafe in Rust there's tools like miri which you can have the coding agent run the code against to make sure it doesn't cause UB or isn't violating Rust's aliasing rules when it comes to unsafe. I still miss writing Zig and find it to be a great language but I like Rust more and coding agents work with better with it.

English
9
4
116
15K
Protty
Protty@kingprotty·
@AndrewGossage33 Makes sense. I write Zig for a dist. sys. company. Initial version used arenas where it could, but its a long-running service & most allocations were persistent / non-lexical (scope based) in their lifetime. Leaks were harder to detect there, esp. due to mixing allocator misuse
English
1
0
1
360
Andrew Gossage
Andrew Gossage@AndrewGossage33·
I write zig for a web API professionally. The only time so far we have had major issues with a memory leak was a leak in curl (that has since been patched) not our own code. Granted we lean very heavily on arena allocation since most of our allocations share a single short lifetime.
English
2
0
3
396
Protty
Protty@kingprotty·
@ZEROX90LLC I agree. As per first bullet, Rust can express most everything that all the other systems PLs can (for the equivalent codegen). But IME, Zig & co. can just express them simpler.
English
1
0
2
350
RJ
RJ@ZEROX90LLC·
@kingprotty Even if you are doing deliberate low level ops Rust does provide (albeit very annoying) infra to ensure it works well across teams.
English
1
0
1
366
Protty
Protty@kingprotty·
For 3. I've observed that teams with devs who struggle with the above can result in "cleanup crew" situations to keep up the speed. A static soundness checker lowers the cost & chance of other team members having to do said cleanup: x.com/_Felipe/status…
Felipe O. Carvalho@_Felipe

Competent engineers can write safe C/C++ and Zig but building a team that’s competent as a collective is really hard. Specially if it’s under market pressure to ship quickly. Now that everyone has a very productive intern working with them at all times, this became obvious.

English
0
0
10
962
Protty
Protty@kingprotty·
For 2. Zig can help with spatial safety, (mis/un)used typed memory operations, and often memory leaks. But it doesn't help with logical/lifetime use-after-frees or data races. Some seem to hit those frequently still, so a static checker can save them after some (minor?) cost.
English
1
0
13
981
Paul Bohm
Paul Bohm@paulbohm·
If your startup does not have a UUID microservice you’re ngmi
Paul Bohm tweet media
English
189
275
6.8K
690.5K
Roman Elizarov
Roman Elizarov@relizarov·
It is so funny to watch non-compiler engineers suddenly discovering that many modern compilers are actually non-deterministic. Sweet summer children! Can’t wait them discovering how many known bugs a typical compiler has.
English
91
47
1.5K
128.5K
Protty
Protty@kingprotty·
@yawaramin @ncs_pl @relizarov @kerckhove_ts probabilistic != random. Can be heuristics (i.e. if fn over 75% of caller's codegen, then inline) or non-determinism (multi-threaded linking). I presume they dont simply disable those
English
1
0
0
42
Protty
Protty@kingprotty·
@ALX23uz @supahvee1234 Rust (& old zig) has stackless coroutines that are decoupled from a scheduler. Compiler just turns a function with yield points into a state machine. They can suspend/resume at a leaf, or anywhere really. Are u referring to C++'s stackless limitations?
English
1
0
1
48
Dellort
Dellort@ALX23uz·
@kingprotty @supahvee1234 He literaly said they are stackless. Stackful coroutines can suspend/resume from anywhere within the stack instead of restricting it on the root. Stackless coroutines require heavy interaction with the scheduler for expressive code or some other trickery.
English
1
0
0
26
Protty
Protty@kingprotty·
@ALX23uz @supahvee1234 why? theyre like stackful but dont encode recursion natively & use a fixed-sized amount of memory
English
1
0
0
34
Dellort
Dellort@ALX23uz·
@supahvee1234 You can just use boost's stackful coroutines, or any other well developed coros. I don't like stackless coroutines.
English
1
0
0
159