Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Java is not V8, of course, because one is a language, and the other one is a VM.

Java is also not JS. Semantics of Java are much better suited to effective compilation than that of JS, due to static typing and (in many cases) early binding. Consequently, modern Java VMs have the best JITs in the industry - faster than V8 - and they're still not on par with C++.

Most applications dynamically link to system libraries. On Linux, this is kinda fuzzy because package managers handle everything; and yes, I agree, on Linux the norm for distro-packaged software is dynamic linking. But stuff packaged as Flatpak etc is much more likely to be statically linked to anything other than libc. And idiomatic C++ tends to involve lots of templates, which are inherently "statically linked".

(Also, native code is broader than C/C++ - it includes e.g. Go, which drops even the libc dependency, and Rust.)

On Windows and macOS, though, where "app is a self-contained folder" has been the rule rather than the exception for a long time now, dependencies that don't come from the OS are often statically linked.



The JVM is hot garbage. It is slow to start up, a memory hog - and like you mentioned previously, overabstracted - no amount of magic unboxing of primitives like int help its performance. There are 100s of different parameters one can set to control garbage collection and other performance characteristics. It's a job in itself dealing with the beast of JVM. YMMV but every time I've dealt with Java I was dissapointed. I'd much rather use C++, Julia, or pretty much any other AOT or JIT than Oracle/Sun's JVM.

You keep saving face. So you admit Linux is largely dynamically linked. Well Windows is too, even to C stdlib, look at how many versions of MSVC runtimes are in your system32 dir after just a few installs. Templates are preprocessor so obviously they are "statically linked."

Microsoft has a COM API (which a lot of C++ uses) but when I used to develop, I'd just call kernel32, user32, advapi32, and other system C APIs directly. COM is a POS imo. DirectX is a decently engineered class-based API. But the rest of them have a lot of flaws.

If you were really hardcore you'd know that these dlls in turn call ntdll, many calls in ntdll are undocumented but much faster than their wrappers in the other dlls. But no sane person is going to strictly do ntdll calls except for the most performance critical code.

I used to reverse engineer and delve deep into the windows API. I know a little bit more about performance than the average high level programmer.

And ultimately, .NET does a fine job with performance. C++ coders crapping all over .NET should take a look at the Objective C API of Apple. It's the default and every Objective C call incurs overhead and is basically a wrapper around the undocumented C API. But I don't think anyone ever complained about this abstraction, because it's such a stupid and small amount of performance to harp about. The convenience outweighs the tiny little uOPS loss.


JVM is a hog, but when it comes to raw compute perf, it's a very fast hog once it starts running. Do you have any examples of anything better (post-startup)?

Yes, I'm well aware that many system DLLs on Windows in turn call into NTDLL, where the actual syscalls are. And yes, I agree that it hardly matters in practice - but it was your premise that inlining across shared object / DLL boundaries is crucial! In practice, yes, it almost never is. And yes, .NET is perfectly fine perf-wise, and even JS is fast enough for most cases. I've actually spent most of my career writing C# and Python, after writing a bunch of C++, and I very much appreciate the productivity gains those abstractions offer.

But this is a very different point. Native code is still measurably faster where it matters, and JS/V8 can't keep up for very good reasons.


Well I guess we are finally in agreement. Right, there are few places where it matters these days.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: