News for hackers. Stuff that matters.
Re:JEP Draft: Deprecate memory-access methods in sun.misc.un... by cogman10 on Tuesday January 16, 2024 @09:50PM (#39022627)
> the story hasn't changed an awful lot since 2004

Um... yeah it has. For starters, hotspot wasn't even a part of the JVM at that point. But further newer JVM additions like the enhanced for loop eliminate a ton of conditions where someone would run into bounds checking. Doing a naked `a[i]` is simply not common java code.

The JVM is far more likely today to remove the bounds check all together than it ever was in 2004.

Re:JEP Draft: Deprecate memory-access methods in sun.misc.un... by iscoelho on Tuesday January 16, 2024 @10:17PM (#39022818)
> Doing a naked `a[i]` is simply not common java code.

It is extremely common in performance sensitive code, 1) graphics & rendering 2) networking 3) buffers

> But further newer JVM additions like the enhanced for loop eliminate a ton of conditions > The JVM is far more likely today to remove the bounds check all together than it ever was in 2004.

There are more comments in this thread that clarify further, but Java is very commonly unable to eliminate bounds checks. You can test all of these things yourself with a quick benchmark - don't take my word for it! The JIT is not as great at this as common rhetoric claims it is.

Re:JEP Draft: Deprecate memory-access methods in sun.misc.un... by rrdharan on Tuesday January 16, 2024 @10:01PM (#39022719)
> For starters, hotspot wasn't even a part of the JVM at that point.

HotSpot had been part of the JVM for five years at that point.

https://en.m.wikipedia.org/wiki/HotSpot_(virtual_machine)

Re:JEP Draft: Deprecate memory-access methods in sun.misc.un... by cogman10 on Tuesday January 16, 2024 @10:16PM (#39022809)
I misread the merge date in the wiki. Hotspot merged into mainline in Java 1.3 in 2000. It was first released as a separate distributable.

That said, in the paper they didn't use sun's JVM they used gcj and their own modified version of gcj.

> We examined the performance of both our new Java implementation as well as standard gcj on a variety of Java applications.

So my point still stands, a lot as changed. The researches chose to use static compilation over a JIT or interpreter.

Re:JEP Draft: Deprecate memory-access methods in sun.misc.un... by pron on Tuesday January 16, 2024 @09:55PM (#39022658)
(and even 20 years ago 125% was still almost order of magnitude less than an order of magnitude)
Re:JEP Draft: Deprecate memory-access methods in sun.misc.un... by iscoelho on Tuesday January 16, 2024 @10:14PM (#39022796)
(and that is quite pedantic)
Re:JEP Draft: Deprecate memory-access methods in sun.misc.un... by foobazgt on Tuesday January 16, 2024 @10:54PM (#39023060)
Order of magnitude in casual conversation typically means 10x. I don't think 2x vs 10x qualifies as pedantic.
Re:JEP Draft: Deprecate memory-access methods in sun.misc.un... by iscoelho on Tuesday January 16, 2024 @11:41PM (#39023400)
Oh I don't disagree at all!

It's a writing error on my end (clear since I qualify the percentage afterwards), so I think focusing on it distracts from the point (which is why I say it's pedantic).

I understand the pet peeve though (-:

Re:JEP Draft: Deprecate memory-access methods in sun.misc.un... by Pet_Ant on Tuesday January 16, 2024 @10:25PM (#39022866)
(it was the best kind of correct: technically correct)
Re:JEP Draft: Deprecate memory-access methods in sun.misc.un... by xxs on Wednesday January 17, 2024 @02:18AM (#39024363)
2004 had java 1.4 + hotspot. 1.5 (w/ generics and stuff) was about to be released. Hotspot was there, so were the Direct Buffers.

Also accessing byte arrays and direct buffers is extremely common - if you do just "business logic" jazz - it does not happen, though. However, every hashmap needs that, pretty much each hash lookup is a direct a[hash]