Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
pkolaczk
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
36 ms
·
421.
▲
by
pkolaczk
4y ago
I haven't found any problems using GTK bindings in Rust. It is actually easier and nicer than in C, especially with additional support like relm4 (but even the manual approach is good enough). Who said GUI must be OOP?
422.
▲
by
pkolaczk
4y ago
In a comment above you've said Java memory allocation had performance of arena allocators. This benchmark shows such statement is very far from thruth. It is not even close. The best you can shoot for with Java ZGC is the overhead leve
423.
▲
by
pkolaczk
4y ago
> you can’t get so called out-of-thin-air values You can't get out-of-thin-air primitive values (no word tearing). But you can still observe states that cannot be explained by any possible sequential interleaving of your program.
424.
▲
by
pkolaczk
4y ago
> And while Java does like to “heap”-allocate, it happens foremost on thread-local buffers and are used pretty much as an arena allocator. Even without escape analysis, these are very cheap all around. If that was true, it would be fairl
425.
▲
by
pkolaczk
4y ago
That's a common wisdom, but there is little if any evidence to support it. True GC costs are simply more hidden and harder to measure. A malloc/free pair might be slightly slower than Java's new (not by much really - go measu
426.
▲
by
pkolaczk
4y ago
Ok, but now you're speaking about a different thing - memory safety. And that is an obvious advantage of Java over C. But C is a very low bar to compare to. There are dozens of other languages which are memory safe and some of them off
427.
▲
by
pkolaczk
4y ago
I haven't said that the JVM would be corrupt by NPE. But C program state would also not be, and you could do the same handling as in Java. But if your code invoked an NPE or bounds check, then it means either the algorithm is incorrect
428.
▲
by
pkolaczk
4y ago
In Java if you encountered a null pointer exception or out of bounds error at the global level, there is also no guarantee you can safely continue, and dumping the stack and terminating is the only sensible option. Sure, the JVM is ok, but
429.
▲
by
pkolaczk
4y ago
But that's not performance category. And, btw, Rust has all 4 of them. If we're talking about safety guarantees then let's add data race freedom to the mix. Or use-after-free protection for non-memory resources. ;) Java is co
430.
▲
by
pkolaczk
4y ago
You can have a null pointer handler in C as well. But this is generally not a good idea. I find software that does not crash early and visibly but instead tries continuing despite an obvious bug very brittle and often causing trouble becaus
431.
▲
by
pkolaczk
4y ago
Low pauses, low memory overhead, low CPU overhead. In Java world, pick one. In C/C++/Rust/Zig you can have all three at once.
432.
▲
by
pkolaczk
4y ago
G1 can do 10 second pauses. I observed them many, many times. It tries not to, but there are no guarantees.
433.
▲
by
pkolaczk
4y ago
I simply don't do cycles. Software is simpler without them.
434.
▲
by
pkolaczk
4y ago
Pausing a single thread to release memory is not what is considered a "pause". Even if pausing a single thread could be a problem, you can trivially offload releasing to another thread. A pause is when all application threads ge
435.
▲
by
pkolaczk
4y ago
> Rust isn't any more complex, but it's not radically simpler either. Safe Rust doesn't have classes, inheritance, copy constructors, move constructors, header files, preprocessor, textual substitution macros, code executi
436.
▲
by
pkolaczk
4y ago
In the given example they are not using the shared reference at all during the whole lifetime of the immutable reference and the operation on the immutable one does not change the object at all, so it would be actually safe. This is the sit
437.
▲
by
pkolaczk
4y ago
Can you share any compiler benchmarks showing Rust compiles slower than C++? I can see something totally opposite in my projects - particularly recompiling after a change is very quick. And cargo check often runs in less than 1s. I never go
438.
▲
by
pkolaczk
4y ago
Rust can include different versions of the same library (crate) in a single project just fine. As long as those are private dependencies, no conflicts would happen. A conflict would happen only if two libraries pass around values of a share
439.
▲
by
pkolaczk
4y ago
I think you focus a lot only on one aspect of thread performance - when you need millions of threads. Yes, I agree, if you need millions of concurrent things running, then you quite likely don't want to use millions of threads. But man
440.
▲
by
pkolaczk
4y ago
> async/await annotations (...) leading to subtle bugs if you forget to put an "await" in the right place In most cases if you forget to call them, the return type would be different and it would be caught by the compiler
441.
▲
by
pkolaczk
4y ago
Nope, many times I submitted a question, got help instantly with a very long explanation telling why the thing I try to do makes sense and should work, but some things in the compiler or libraries haven't been stabilized or finished ye
442.
▲
by
pkolaczk
4y ago
It is not a syntactic burden, because it provides valuable information to the code reader. It is very important to me that I can quickly spot all places where execution can wait. For example, the user interface should take that into account
443.
▲
by
pkolaczk
4y ago
My point was that you can program in Rust in the exactly same style as Go, not hitting any of the problems mentioned in the linked article. Just use tokio::spawn and tokio channels and you get all the stuff you have in go. And btw, I just d
444.
▲
by
pkolaczk
4y ago
That's not Rust's fault but library creators / programmers fault who often paint themselves into corner by refusing to use a heap allocation or clone here and there. Once you are ok with occasional boxing, you can easily do a
445.
▲
by
pkolaczk
4y ago
> To the point that I avoid using rust for web /networking stuff, any other option is better How can you write networking concurrent code in Golang then? It doesn't support async traits either. Well, it doesn't support a
446.
▲
by
pkolaczk
4y ago
> There is nothing about OO does enforce higher memory usage compared to other patterns. Many OO languages offer dynamic/virtual dispatch of methods as a primary (and sometimes only) way to do polymorphism. This comes at a non-zero
447.
▲
by
pkolaczk
4y ago
Investment ratio in Go is only good because of how little you have to invest. In Rust the required investment is bigger, but you get a lot more in return. Not sure about which ratio is really better. GC is only a minor reason I chose Rust o
448.
▲
by
pkolaczk
4y ago
> Write a server that does communication or emulate select in Go in other languages. I just did that - I've been working on a very similar thing to goduplicator (a mirroring proxy), however with an additional requirement that it mus
449.
▲
by
pkolaczk
4y ago
If by "escape hatch" you mean unsafe blocks, then whole C++ is an escape hatch.
450.
▲
by
pkolaczk
4y ago
The number of ways to write something is only very loosely correlated with maintainability. The ease of maintenance is IMHO more a function of how much information about the properties of the code you can easily read from the text, and how
More ›