Java has significant overhead, that most/every object is allocated on heap, synchronized and has extra overhead of memory and performance to be GC controlled. Its very hard/not possible to tune this part.
You program differently for this niche in any language. The hot path (number crunching) thread doesn't share objects with gateway (IO) threads. Passing data between them is off heap, you avoid object creation after warm up. There is no synchronization, even volatile is something you avoid.
how exactly you are passing data? You can pass some primitives without allocating them on heap. You can use some tiny subset of Java+standard library to write high performance code, but why would you do this instead of using Rust or C++?
Strangely this is one of the areas where I want to use project panama so I might re-implement some of the ring buffers constructs.
You allocate off heap memory and dump data into it. With modern Java classes like Arena, MemoryLayout, and VarHandle it's honestly a lot like C structs.
> You allocate off heap memory and dump data into it. With modern Java classes like Arena, MemoryLayout, and VarHandle it's honestly a lot like C structs.
my opinion is that no, it is not, declaring and using C struct is 20x times more transparent, cost efficient and predictable. And that's we talking about C raw stucts, which has lots of additional ergonomics/safety/expression improvements in both c++ and rust on top of it.
Optimal in what sense? In the java shops I've worked at it's usually viewed as a pretty optimal situation to have everything in one language. This makes code reuse, packaging, deployment, etc much simpler.
In terms of speed, memory usage, runtime characteristics... sure there are better options. But if java is good enough, or can be made good enough by writing the code correctly, why add another toolchain?
> But if java is good enough, or can be made good enough by writing the code correctly,
"writing code correctly" here means stripping 95% of lang capabilities, and writing in some other language which looks like C without structs (because they will be heap allocated with cross thread synchronization and GC overhead) and standard lib.
Its good enough for some tiny algo, but not good enough for anything serious.
It's good enough for the folks who choose to do it that way. Many of them do things that are quite "serious"... Databases, kafka, the lmax disruptor, and reams of performance critical proprietary code have been and continue to be written in java. It's not low effort, you have to be careful, get intimate with the garbage collector, and spend a lot of time profiling. It's a totally reasonable choice to make if your team has that expertise, you're already a java shop, etc. I no longer make the choice to use java for new code. I prefer rust. But neither choice is correct or incorrect.
> Databases, kafka, the lmax disruptor, and reams of performance critical proprietary code have been and continue to be written in java.
those have low bar of performance, also they mostly became popular because of investments from Java hype, and rust didn't exist or had weak ecosystem at that time.
> there is a large class of programs that can be expressed very simply using async rust but would be very complicated to express in sync rust (assuming equivalent performance).
I challenge that this class is large, at least in the area of my expertise: backend and data processing.
Be serious. I don't care about any of europe; the rest of the west is doing just fine caring about it incessantly at the top of their voices regardless of who asked. My heart belongs in east africa.
I'll try to be more sensitive with what I capitalize—but I don't really give a damn about either ukraine or russia—both seem like far-right corrupt states that don't take care of their citizens well—though I do feel very sad for the humans caught between them.
Iran is real threat to oil circulation in that region, they applied this tactics many times before. Now imagine if we come to current situation 5 years later when Iran has missiles with nuclear warheads?
Feel free to list the details about when, how and why it happened before ;) interestingly none of these scenario would even have happened if they had nukes to begin with, how weird
The only weird thing in this story is that we keep preemptively bombing the same people for at best vague reasons (they were about to attack us trust me bro) and at worst complete made up lies (they have mass destruction weapons, look at my jar of anthrax).
depends how you define "attack us". Iran is part of Iran-Russia-China axis, which goals are very explicit in expanding influence and territories (Ukraine, Taiwan, Syria, Iraq, Gulf states). If they succeed, Western world will be cut from semiconductors and oil and become much weaker.
Might, may, could, potentially, maybe... Virtually nothing happened in decades and now that the US/Israel decided time was up the situation is more fucked than it has ever been, potentially pushing the Iranian government into more radicalism, good job! That will teach them. "we had to attack because they could theoretically cut us from oil in a distant future", how is it going so far?
How did it go in Iraq? Afghanistan? What's up with kidnapping Maduro? Is this what the "western world" is about? Securing resources by bombing people preemptively because they might do something you don't like one day?
You can't look at the recent history of the region and point the finger at literally anyone else other than the US with a straight face lmao, you're the blood thirsty nation who's military industrial complex got out of hand, just watch the latest videos posted by the official white house accounts, only psychopaths would come up with these
> it was decades of very intense proxy wars: Yemen, Syria, Iraq, Gaza, Lebanon. Iran didn't hesitate to attack oil assets
Compared to the US and Israel who only mind their own business and never do any shady things of course. Russia says the same thing about the US in Ukraine, but there it's a dirty propaganda lie, when it comes to Iran it's just the Real Truth ™
Plenty of other nations (including Iran for decades) are not getting this stick. Carrots were even offered. The USA has remained remarkably calm remarkably long. Imagine this had been executed before Hamas parachuted a Jewish music festival? Gaza wouldn't have been sandwiched between Israel on one side and Iran's Hamas on the other. Imagine Iran had fallen (it hasnt yet) before that event. Israel wouldn't possibly have been able to "justify" doing a genocide in Gaza even to its own population!
you are putting words in the mouth of your discourse partner: approaching nuclear weapons capabilities is the reason for attack, waiting until its too late is obviously not considered an option.
Like when Iraq was just about to drop anthrax all over the US? We should study the psychology of normies falling over and over for the same propaganda techniques even when it goes again their own interests
This is old information. Japan's borrowing costs have spiked and are ~2.18% as of this comment. Yields are surging due to their debt load (currently ~240% of GDP).
Its way more painful for rest of the world except Russia, and not US. They will make little pain on US, and make world and neighbors extremely angry on them.
reply