Live data from Hacker News

Don’t call it a comeback: Java is still champ

github.com

281–290 of 557 posts

Re: Don’t call it a comeback: Java is still champ

#281
post #269
post #242

Earlier quoted context omitted.

It looks like caching definitely skewed the results a bit. You can take a look at the linked code yourself. Worst case was still only around 80 nanoseconds which is definitely slower, but still orders of magnitude faster than "sub 5 micros". Don't take my word for it though, you can take a look at the Robin Hood benchmarks[0]. Robin Hood unordered map is a competitive hash map that's performed much better than the ST…

Did I read that right? The C# version is computing SHA256 hashes?

That's a link to the benchmark framework that I used. The C# benchmark are in a separate gist that I didn't feel like digging up. This is the C# benchmarks[0]. All the interfaces and indirection is the result of me adapting this from a separate comment. But the benchmark is just testing `HashSet.TryGetValue`.

Edit: I just re-ran the benchmarks because I didn't have the results pasted in the snippet (which I've now done so I don't keep getting this wrong haha). The C# HashSet takes around 130 nanoseconds, not microseconds. So it's not orders of magnitude slower, but it is still more than a 2x slow down and up to a 100x slow down in the case of an integer key.

[0]: https://gist.github.com/ambrosiogabe/ba6bd0fa80588c2fd2ca26d...

Re: Don’t call it a comeback: Java is still champ

#282
post #222

Earlier quoted context omitted.

And for the fraction of the software projects out there that that actually need this feature as a hard requirement, I'm sure it's wonderful.

Well many-to-many IS the point of the internet. Think MMO here, which is the "metaverse" thing they keep talking about. Simulating 3D reality over the network IS the ONLY thing humans can do now that doesn't HAVE to burn all the energy we got left while giving use a tool to experiment without risk. So I'm building the final 3D action MMO game engine.

Everyone dreams of their own MMO but nobody wants to pay for it except whales.

Re: Don’t call it a comeback: Java is still champ

#283
post #27

The only problem Java has is experienced C programmers don't build servers from scratch with it yet. Once they take that responsibility, the debate will be over because: "While I'm on the topic of concurrency I should mention my far too brief chat with Doug Lea. He commented that multi-threaded Java these days far outperforms C, due to the memory management and a garbage collector. If I recall correctly he said "only…

The p50 speed up from delaying memory management comes with a trade off, namely you get Garbage Collection pauses, bad p99, and spend your effort tuning the Garbage Collector instead of your code.

> Garbage Collection pauses

True concurrent GC have been available since late 2000s. Azul had a read-barrier GC as well - effectively a pauseless GC (or pauses under 1ms)

Re: Don’t call it a comeback: Java is still champ

#284
post #11

I recently started a side new project in Java targetting GraalVM with language version 17. Aside from Java's innate finickyness, it has been an unexpected pleasure. I think a lot of it has to do with its static typing (I typically work in dynamic languages, and it's nice knowing that if the program compiles it likely works), and how simple the language keeps its primitives. But you need really good tooling to use it,…

> But you need really good tooling to use it, like a powerful IDE with good autocompletion and refactor support. It is way too verbose to type everything out yourself, and the verbosity means manually refactoring takes lots of changes around the program to manifest. One of the ironies of Java has been that its strictness and verbosity can make it hard to develop, but that strictness also enabled the development of po…

Yes. I worked many years in both Java and C#. In Java every project and codebase I saw was pretty much the same.

In c# when I look at other people's projects I often feel like it's a foreign language. You can make it look like C++ with unsafe blocks. You can nake it look like ruby with dynamic variables. You can write sql-like statements.

As much as I love writing in C#, I prefer reading other people's Java.

Re: Don’t call it a comeback: Java is still champ

#285
post #142
post #11

I recently started a side new project in Java targetting GraalVM with language version 17. Aside from Java's innate finickyness, it has been an unexpected pleasure. I think a lot of it has to do with its static typing (I typically work in dynamic languages, and it's nice knowing that if the program compiles it likely works), and how simple the language keeps its primitives. But you need really good tooling to use it,…

My main problem with Java is that it's picky, and has some static typing, but it also has heaps and heaps of loopholes in the type system (that turn into runtime exceptions), so it's this weird compromise where everything is substandard. I've found that Go "feels" a lot more like a dynamically typed language, but still has the good IDE support that you're talking about. If you want to see how much progress there has…

> In addition to being memory safe without a GC, the compiler also confirms that your code is threadsafe.

No, not at all. Rust verifies that your code has no data-races. That is an absolutely tiny subset of all race conditions, that are simply not verifiable statically.

Re: Don’t call it a comeback: Java is still champ

#287
post #122

Earlier quoted context omitted.

That sounds a lot like the complaints about Java from a decade ago. Have you used it lately? Java's GCs are incredible and you have a menu of algorithmic options that let you avoid whatever problem you're worried about.

> Java's GCs are incredible and you have a menu of algorithmic options can these options be used in separate parts of a single app ? e.g. the app I'm developing in C++ has parts that do realtime audio, others that do GPU rendering, others that do classic Qt Widgets GUI, others that do offline computations on datasets - and they all have different performance characteristics and need different memory management scheme…

If Java had isolated heaps then C++ would become redundant in every aspect except memory efficiency.

Re: Don’t call it a comeback: Java is still champ

#288
post #255

Earlier quoted context omitted.

The only problem Java has is experienced C programmers don't build servers from scratch with it yet. Please explain. What kind of crazy jack write servers in C? (Real question, trying to learn here)

The developers of apache httpd, nginx, postgresql, redis, among many others?

you really dont need redis if you have java. I see zero reasons to offload my datastructures via TCP, instead of have them locally. If need be, replicated them.

Re: Don’t call it a comeback: Java is still champ

#289
post #101

Earlier quoted context omitted.

Weird Spring is the reason why i am sticking to Java

I just can't get past annotations as a thing. Seems like a crime against programming to me.

I don’t know, I think it’s closer to some LISP magic macro than Lispers would like to admit. They are extremely powerful, and thus can be responsible for some very ugly code, but when used responsible, they are huge productivity wins.

Re: Don’t call it a comeback: Java is still champ

#290

Earlier quoted context omitted.

I really like the C# object initializer syntax, and it looks like the next version might get rid of the last problem I had with it. Right now it does not play nice with nullable types, if a property is declared non-nullable you have to use a constructor or some ugly trick to circumvent the warnings. As far as I understand this will be fixed in .NET 7 (not sure if the decision is final, though) and you can get the ful…

If you perhaps happen to know or have a pointer: how would that work in C#? A field not initialised will be null, and if it’s non-nullable… what’s its value going to be?

The check would be moved to the object initialization, so the compiler would tell you if you use the flexible object initialization syntax and left some non-nullable properties uninitialized.
Post reply on HN