this post was submitted on 23 Aug 2023
521 points (96.9% liked)

Technology

59377 readers
3428 users here now

This is a most excellent place for technology news and articles.


Our Rules


  1. Follow the lemmy.world rules.
  2. Only tech related content.
  3. Be excellent to each another!
  4. Mod approved content bots can post up to 10 articles per day.
  5. Threads asking for personal tech support may be deleted.
  6. Politics threads may be removed.
  7. No memes allowed as posts, OK to post as comments.
  8. Only approved bots from the list below, to ask if your bot can be added please contact us.
  9. Check for duplicates before posting, duplicates may be removed

Approved Bots


founded 1 year ago
MODERATORS
 

Since its inception, Microsoft Excel has changed how people organize, analyze, and visualize their data, providing a basis for decision-making for the flying billionaires heads up in the clouds who don't give a fuck for life off~~the~~line

you are viewing a single comment's thread
view the rest of the comments
[โ€“] Valmond@lemmy.mindoki.com 0 points 1 year ago (1 children)

Well that was a lot of misconceptions.

So compiler will make java as fast as C++ but not C++ as fast as C?

Also, when speed matters it's never great to have huge Java classes, it just won't be optimised away (anough) and you'll have a memory / bus bottleneck.

Also, if you really want speed you go parallel, IDK if java is up for the challenge lol (can you configure stackspace and so?) or to beat them all, you run it on the GPU (or several GPU lol :-)

[โ€“] Aceticon@lemmy.world 5 points 1 year ago

I think I didn't explain myself correctly.

The Just In Time Compiler in a Java Virtual Machine which does a final compilation step at runtime from JVM assembly to native code will make the typical code in algorithms run as fast as in C++ because ultimatelly they both end up as the same assembly. I've actually measure this by the way, though it was years ago.

However things like memory architectures are different between those languages and the one in C++ can easilly be made faster than in Java, though the downside of that memory architecture is nastier bugs.

Further, and this time about general performance, if you're worried about performance above all, then in terms of general performance, C is generally faster than C++: for example virtual functions in C++ objects have calling overheads which function calls when there is no inheritance do not have so unless you don't use inheritance at all, some function calls in C++ will be slower.

As for parallelization, I've actually worked both in massive parallel Java with distributed computing and GPU computing and they're completelly different kinds of parallelization with different capabilities and optimal use cases: good luck making a CUDA application optimized for serving paralled requests from millions of clients sourcing data from multiple sources and good luck making an LLM runtime with distributed computing in Java were parts of the pre-trained neural network are in different machines - GPU computing can't arbitrally decide it needs some data and fetch it whilst the overhead of synching two parts of a Java system running in different machines is way (millions of times?) larger than the overhead of synching read-then-write-access to the same position in a RWStructuredBuffer from 2 different processing units.

Comparing these two kind of parallelism is not an apple and oranges comparison, it'sm more like an apples and horseshoes comparison.