3 ms·
"Read/write" method of "Input/OutputStream" are not synchronized. but "ByteArrayInput/OutputStream" are synchronized methods. Old version opack call "read/write
by devjeonghwan 5y ago
"Read/write" method of "Input/OutputStream" are not synchronized. but "ByteArrayInput/OutputStream" are synchronized methods.
Old version opack call "read/write" method frequently, but only call from single thread. (not allow multiple thread use to one context)
before JVM15, synchronized "read/write" method of "ByteArrayInput/OutputStream" was cheap, when single thread going through. (use biased locking)
"JEP 374" has a performance penalty for single threads going through syncrozied blocks.
- exabrial 5y agoInteresting. A _lot_ of libs use ByteArrayInput/OutputStream extensively, this could have some deep reaching effects.