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 — Simplify reference counting by chrisvest · Pull Request #15764 · netty/netty Conversation
|
|
@franz1981 Please try benchmarking these changes. On my M1, I get performance in If I change |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
But to be fair, it matters? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
You can try applying this on top of my adaptive pull and see how to perform since I didn't get rid of the chunk ref count for size classed because I was waiting this ❤️ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
It wasn't faster without the parity bit on my machine. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I believe it - I will try on my x86 as well to check how it behaves. I have to check to if it solves the problem in the issue related set bytes too |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Also, I suspect the contended case is relevant for the chunks. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Uh, you are right. It is indeed (for shared magazines). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Huh, interesting. I'm actually getting pretty reliable JIT compiler crash on the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Looks like I can make the compiler crash go away by collapsing the implementations down as well, so we only have AbstractReferenceCounted and no longer need the impls in Chunk and AbstrsctReferenceCountedByteBuf. And a few other small tweaks. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
4f58b3e to
c6afb03
Compare
|
To work-around the JIT bug, I've had to increase the scope of this PR to also collapse the three different |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ReferenceCounted And also work-around what appears to be a C2 JIT compiler bug in Java 17 through 25+.
c6afb03 to
f410cc2
Compare
| } | ||
| } | ||
|
|
||
| private static class Chunk extends AbstractReferenceCounted implements ChunkInfo { |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Consider that w 8953bbe I plan to make Chunk's reference count to exist only for the BumpChunk (bad name I know :"()
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yeah. And this is also breaking the graal build as-is… need to think about what to do here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Check franz1981#1
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The idea of collapsing the hierarchy is very similar to what @yawkat has done on franz1981#1 and will likely avoid the problem of bimoprhic inlining + fat compiled methods observed in #15736 (comment). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I have cherry picked both your changes on top of #15741 getting whilst my last commit was delivering which shows a slightly regressed performance in the non-"polluted" case With the change at #15764 (comment) the performance is (nearly) restored: Adding #15764 (comment) too (to the previous one) completely restore the performance: I have the suspect we can get better on |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@franz1981 I applied the optimizations you suggested. They don't seem to make any noticeable difference on M1, but if they help x86 we'll of course take that win. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
78ccf85 to
b077572
Compare
e5c3b63 to
4c09131
Compare
|
@franz1981 @normanmaurer Please take a look. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
In term of performance it will have some impact for the most common case (as explained in the description I already gave), but in a follow up PR it enables us to likely re-enable VarHandle for native image as well.
I will run few benchmarks, likely early next week; in case, we still have the option B which would remove any chance for regression - with @normanmaurer blessing
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@chrisvest @franz1981 let me know once I should review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think @normanmaurer this is ready to go, apart from the small comments I sent. I still believe this is bringing unwanted performance effects which the option 2. B would save, as I have explained in another comment for you 🙏 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@normanmaurer @franz1981 Last few comments addressed. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| static final int EMPTY_BYTE_BUF_HASH_CODE = 1; | ||
| private static final ByteBuffer EMPTY_BYTE_BUFFER = PlatformDependent.allocateDirect(0).buffer(); | ||
| private static final ByteBuffer EMPTY_BYTE_BUFFER = ByteBuffer.allocateDirect(0); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
seems unrelated...
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
On Graal 25, PlatformDependent.allocateDirect will use our MemorySegment based cleaner implementation. Turns out Graal will refuse to put native memory segments on the image heap because they contain native pointers which when initialized at build time may not be valid at runtime, even though in this case the segment is zero bytes in length and it would almost certainly be fine.
Since the EMPTY_BYTE_BUFFER instance is never deallocated and doesn't contribute to native memory usage (or only contributes one pointer size of bytes), I thought making this change would be a fair trade off.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| * compared to when {@link ReferenceCountUpdater} is used. | ||
| */ | ||
| @SuppressWarnings("deprecation") | ||
| public class RefCnt { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
hmmm after thinking a bit more about it wouldn't that basically break again on older android versions:
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@chrisvest I think the problem exists here as well as we import the VarHandle.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine because all VarHandle uses happen in VarHandleRefCnt which is a separate class that is never loaded when VarHandle is not supported
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
ok if that works I am happy :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
This reverts commit a8e370d.
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.