Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
pkolaczk
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
13 ms
·
121.
▲
by
pkolaczk
2y ago
If a future is canceled it will run its destructors, so cleanup will usually happen correctly even if the developer didn’t think about it. Connections and files will be closed, memory released, locks unlocked. There are exceptions to that o
122.
▲
by
pkolaczk
2y ago
Ok, point taken, indeed it reads like that. However, in programming and generally in engineering this is a very useful concept. There is a difference between "component X is part of Y" than "component X works / interacts
123.
▲
by
pkolaczk
2y ago
Compared to most popular high level languages like Java or Go, Rust is seriously at the more expressive end (read: can be higher level).
124.
▲
by
pkolaczk
2y ago
> It is more verbose than something like Go or Python Quite debatable. My experience is different. I have ported some tiny amount of Go code to async Rust and it turned out to be simpler and shorter. Way less boilerplate related to clean
125.
▲
by
pkolaczk
2y ago
Ownership is not implementation. Ownership is contract. If you’re an owner of a house you can do more than if you’re only renting and if you’re renting you can do more than if you’re only looking at the house from the street. Ownership is a
126.
▲
by
pkolaczk
2y ago
> Reduced fuel consumption using hybrid technology works in the city. Works on a highway as well, but the difference is smaller.
127.
▲
by
pkolaczk
3y ago
Java cannot express immutability. `final` is not transitive, so nothing stops an unrelated change in code to break something that was immutable earlier. Same with Golang.
128.
▲
by
pkolaczk
3y ago
In languages like C++ and Rust the majority of objects have trivial lifetimes and don't need reference counting at all. It is less than 0.1% of heap objects that need to be tracked by Rc/Arc, and even for them the reference update
129.
▲
by
pkolaczk
3y ago
Refcounting introduces zero latency into code that doesn't allocate / free. Tracing can pause such code. Zero latency is better than non-zero.
130.
▲
by
pkolaczk
3y ago
It may not be a problem in a language like Rust, where the compiler understands the concept of immutability. But most (if not all) mainstream languages except Rust don’t. Your object may be immutable in January but in February someone makes
131.
▲
by
pkolaczk
3y ago
Try-with-resources doesn’t guard against use-after-close. Rust RAII does.
132.
▲
by
pkolaczk
3y ago
Introducing caching is a semantic API change, regardless of the way how memory is managed, so it should be breaking. After introducing caching, now you also accidentally introduced sharing, because two consecutive API calls can return the
133.
▲
by
pkolaczk
3y ago
You don’t need pinning in regular async code in Rust. This is for library writers.
134.
▲
by
pkolaczk
3y ago
> and a slightly lower memory overhead 3x to 100x is not „slightly” in my dictionary.
135.
▲
by
pkolaczk
3y ago
It goes even a step further. You can write a lot of Rust code with exactly zero heap allocations in the critical paths. While at the same time we’re struggling getting our Java code to stay below 1 GB/s heap allocation rate. Rust recou
136.
▲
by
pkolaczk
3y ago
Same experience with doing database system programming in Java. The number of performance issues caused by GC and the amount of code complication introduced in order to avoid them is mind-blowing. We’re managing memory manually in critical
137.
▲
by
pkolaczk
3y ago
Still no, because STW GC can pause innocent code in arbitrary unexpected moments. If you’re pausing the thread because the thread is doing some work eg calling into system to do I/O, this is not considered a pause (even though technica
138.
▲
by
pkolaczk
3y ago
> The only languages that choose a refcounting GC are either those that care little about performance (Python) or those that don't rely heavily on GC (Rust). Not true. The creators of Swift chose RC exactly for performance reasons:
139.
▲
by
pkolaczk
3y ago
Generational hypothesis fails pretty miserably for some very practical and common workloads - e.g. caching. The real world is way more complex than short lived vs forever. There are many objects with midterm lifetimes as well. Hence, genera
140.
▲
by
pkolaczk
3y ago
And, additionally, reference counting on a single thread doesn’t need barriers at all.
141.
▲
by
pkolaczk
3y ago
> That's why high-performance languages that rely heavily on a GC -- Java, C#, Go -- prefer tracing. And yet, despite 30+ years of compiler and GC research, they are still in the second performance league. All languages in the first
142.
▲
by
pkolaczk
3y ago
> good tracing GCs have long ago surpassed manual memory management in throughput, and more recently their latency impact is more than acceptable for the vast majority of applications There is a very subtle problem you seem to be missing
143.
▲
by
pkolaczk
3y ago
It’s not an issue in practice because, contrary to tracing GC, it doesn’t affect the other threads. So it doesn’t really count as pausing.
144.
▲
by
pkolaczk
3y ago
The problem is not only how long the pause takes but also the fact it pauses all the things. In manual memory management even if you have to spend some time in allocation / deallocation, it affects only the allocating thread. A thread
145.
▲
by
pkolaczk
3y ago
Fragmentation rarely wastes more than 20% memory and 50% is extremely unlikely. But with tracing GC you’re often wasting 4-5x right from the start. Maybe it’s not called fragmentation, but the room needed for the GC to run efficiently is al
146.
▲
by
pkolaczk
3y ago
> Rust can run multiple threads just fine Rust is also used in environments which don't support threads. Embedded, bare metal, etc.
147.
▲
by
pkolaczk
3y ago
The borrow checker is not responsible for even 1% of compilation time. The elephant in the room is monomorphisation and macro expansion. Those generate a ton of code that LLVM has to process. In return you get much faster programs at runtim
148.
▲
by
pkolaczk
3y ago
Two of my friends who had their bearings and double-mass wheel replaced in their cars around only as little as 100 - 150 kkm (one TSI another TDI) disagree with them. The lower the RPM, the higher the momentum needed to keep the car acceler
149.
▲
by
pkolaczk
3y ago
Upshifting at 2k RPM while accelerating is a fast way towards destroying the engine (especially the rod bearings and the dual-mass wheel) in less than 100 kkm. And I bet those upshift indicators don't take into account the temperature
150.
▲
by
pkolaczk
3y ago
It’s not the problem with binding to Rust. Python can do it, Zig can do it, C can do it, even JS can do. It is Go which doesn’t integrate well with anything that isn’t Go.
More ›