3 ms·
Reading this thread as C programmer has me scratching my head. Of course you have to resort to low-level functionality to achieve performance. That's how compu
by alextgordon 11y ago
Reading this thread as C programmer has me scratching my head.
Of course you have to resort to low-level functionality to achieve performance. That's how computers work. We can't all live in fuzzy wuzzy land.
Surely Unsafe is safer than writing the whole thing in C and using JNI?
- trb8 11y agoYes. Also there are many "safe" operations on "unsafe". Such as memory fences.
- vardump 11y agoMultithreading is somewhat unsafe in general. And so is ability to do most I/O, you might overwhelm the system.
- trb8 11y agoSure. Unsafe in terms of program correctness. By that measure, new Thread() is unsafe. But that's not a reasonable definition of "unsafe". This could crash the JVM is a reasonable definition. And fences and ordered instructions cannot.
- Daneel_ 11y agoI completely agree - I have no problem with leveraging low-level functionality, but there's usually a safe and and unsafe way to approach it - and from what I've read 'unsafe' doesn't take the secure approach. (separately: why the downvote? I get downvoted for having the opinion that it's worth a tiny bit of performance for improved security?)