GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||
GeezerVison is showing github.com — Faster setZero (Fixes #13692) by franz1981 · Pull Request #13693 · netty/netty Conversation
Contributor
Motivation: Unsafe's buffer setZero always piggyback to the JDK's Unsafe::setMemory, Modifications: Handle small writes with a specialized code path which won't rely on Unsafe::setMemory Result: Faster setZero(...) and writeZero(...)
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
franz1981
force-pushed
the
4.1_setzero
branch
2 times, most recently
from
4a143fc to
523f6c7
Compare
Motivation: Unsafe's buffer setZero always piggyback to the JDK's Unsafe::setMemory, which is not optimized for small writes, given that's not an intrinsic candidate and requires handling thread-state transitions. Modifications: Handle small writes with a specialized code path which won't rely on Unsafe::setMemory Result: Faster setZero(...) and writeZero(...)
franz1981
force-pushed
the
4.1_setzero
branch
from
523f6c7 to
c09b4f2
Compare
franz1981
marked this pull request as ready for review
|
There was an error while loading. Please reload this page.
|
@normanmaurer and @imangry these are the results for the latest commit The improvement "seems" dramatic (but need to take in account that the accessed buffer's memory is always in L1 cache, and hot, which is not what always happen in real world!), for smaller write size as expected, which seems to be due to the presence of the Last but not least; this is a microbenchmark trying to measure a very tiny effect: according to some of the reported numbers (eg ~1.4 ns, which is too near to the L1 cache access latency of my Ryzen box) it's likely we're affected by the JMH infra as well (although less by using compiler's black holes), meaning that some of the differences are not as meaningful as they could be given that they both includes the JMH infra. The test has run on The perfasm analysis shown the presence of the mentioned calls and the original issue solved here reported already the relevant JDK src code paths involved. I've decided for 64 bytes as a cutoff value to honor AVX512, but probably even higher values could benefit from this (in short, I've been conservative with the original code). It's interesting to note it by checking the difference between 64 and 65 bytes results. I didn't reported heap/unpooled data because not relevant, given that is 1:1 in term of perf increase. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@franz1981 nice work! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@franz1981 can you also do a PR for main ? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Motivation: netty#13693 introduced a buggy alignment rounding while zeroing off-heap memory on platforms which requires aligned accesses Modifications: Use a safer branchless alignment rounding to save down-casting and handle correctly the negative cases while fixing the original bug. Result: Faster alignment and no more assertion failures on aligned platforms
Motivation: #13693 introduced a buggy alignment rounding while zeroing off-heap memory on platforms which requires aligned accesses Modifications: Use a safer branchless alignment rounding to save down-casting and handle correctly the negative cases while fixing the original bug. Result: Faster alignment and no more assertion failures on aligned platforms
Motivation: #13693 introduced a buggy alignment rounding while zeroing off-heap memory on platforms which requires aligned accesses Modifications: Use a safer branchless alignment rounding to save down-casting and handle correctly the negative cases while fixing the original bug. Result: Faster alignment and no more assertion failures on aligned platforms
Motivation: #13693 introduced a buggy alignment rounding while zeroing off-heap memory on platforms which requires aligned accesses Modifications: Use a safer branchless alignment rounding to save down-casting and handle correctly the negative cases while fixing the original bug. Result: Faster alignment and no more assertion failures on aligned platforms Co-authored-by: Francesco Nigro <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.