Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Methods hot but too big for inline #1812

Closed
normanmaurer opened this issue Sep 4, 2013 · 6 comments
Closed

Methods hot but too big for inline #1812

normanmaurer opened this issue Sep 4, 2013 · 6 comments
Labels
Milestone

Comments

@normanmaurer
Copy link
Member

@normanmaurer normanmaurer commented Sep 4, 2013

While doing some benchmarks I noticed there are a few methods that are hot but are to big for the JIT to inline. We should check if we could do a better job here and optimize them for the most common usage in terms of size etc.

This way the JIT can make inline happen:

@ 25   io.netty.handler.codec.http.HttpObjectDecoder::decode (1159 bytes)   hot method too big
@ 17   io.netty.channel.ChannelOutboundBuffer::nioBuffers (360 bytes)   hot method too big                              @ 25   io.netty.handler.codec.http.HttpObjectEncoder::encode (458 bytes)   hot method too big
@ 14   io.netty.handler.codec.http.HttpObjectDecoder::parseHeaders (525 bytes)   hot method too big
@ 110   io.netty.handler.codec.http.HttpObjectDecoder::splitInitialLine (399 bytes)   hot method too big
@ 42   io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe::read (729 bytes)   hot method too big
@ 25   io.netty.handler.codec.http.HttpObjectEncoder::encode (458 bytes)   hot method too big
@trustin
Copy link
Member

@trustin trustin commented Sep 4, 2013

Out of curiosity, how did you get this data?

@normanmaurer
Copy link
Member Author

@normanmaurer normanmaurer commented Sep 5, 2013

@trustin start with "-XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining" and check the generated outpout. Best is to direct it to some file as it will be quite "heavy" ;)

Related blog post: http://techblug.wordpress.com/2013/08/19/java-jit-compiler-inlining/

normanmaurer pushed a commit that referenced this issue Sep 5, 2013
This move less common method patterns to extra methods and so make the nioBuffers() method with most common pattern (backed by one ByteBuffer) small enough for inlining.
normanmaurer pushed a commit that referenced this issue Sep 5, 2013
This move less common method patterns to extra methods and so make the nioBuffers() method with most common pattern (backed by one ByteBuffer) small enough for inlining.
@trustin
Copy link
Member

@trustin trustin commented Sep 5, 2013

Ah, Thanks.

normanmaurer pushed a commit that referenced this issue Sep 5, 2013
…line. Related to #1812

encode of chunked content is not the most common pattern so moving it to an extra method makes it possible to inline the rest as it is a smaller method now.
normanmaurer pushed a commit that referenced this issue Sep 5, 2013
…line. Related to #1812

encode of chunked content is not the most common pattern so moving it to an extra method makes it possible to inline the rest as it is a smaller method now.
@jestan
Copy link
Member

@jestan jestan commented Sep 5, 2013

Nice findings @normanmaurer :)

@CodeMason
Copy link

@CodeMason CodeMason commented Sep 5, 2013

Indeed - that's very nice!

On Thu, Sep 5, 2013 at 7:47 AM, Jestan Nirojan notifications@github.comwrote:

Nice findings @normanmaurer https://github.com/normanmaurer :)


Reply to this email directly or view it on GitHubhttps://github.com//issues/1812#issuecomment-23861940
.

@tsingxu
Copy link
Contributor

@tsingxu tsingxu commented Sep 8, 2013

how interesting

normanmaurer pushed a commit that referenced this issue Oct 23, 2013
… allow for inlining"

This reverts commit b7262ab.
normanmaurer pushed a commit that referenced this issue Oct 24, 2013
normanmaurer pushed a commit that referenced this issue Oct 25, 2013
normanmaurer pushed a commit that referenced this issue Oct 26, 2013
normanmaurer pushed a commit that referenced this issue Oct 26, 2013
@normanmaurer normanmaurer mentioned this issue Oct 27, 2013
normanmaurer pushed a commit that referenced this issue Nov 7, 2013
…from the Channel.

This was introduced as part of #1812, but fortunatualy was not part of any release.
normanmaurer pushed a commit that referenced this issue Nov 7, 2013
…from the Channel.

This was introduced as part of #1812, but fortunatualy was not part of any release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.