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

Comments

Projects
None yet
5 participants
@normanmaurer
Member

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

This comment has been minimized.

Show comment
Hide comment
@trustin

trustin Sep 4, 2013

Member

Out of curiosity, how did you get this data?

Member

trustin commented Sep 4, 2013

Out of curiosity, how did you get this data?

@normanmaurer

This comment has been minimized.

Show comment
Hide comment
@normanmaurer

normanmaurer Sep 5, 2013

Member

@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/

Member

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

Norman Maurer
Split up the nioBuffers() method to allow for inline. Related to #1812
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

Norman Maurer
Split up the nioBuffers() method to allow for inline. Related to #1812
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

This comment has been minimized.

Show comment
Hide comment
@trustin

trustin Sep 5, 2013

Member

Ah, Thanks.

Member

trustin commented Sep 5, 2013

Ah, Thanks.

normanmaurer pushed a commit that referenced this issue Sep 5, 2013

Norman Maurer
Move encode of chunked content to an extra method, this allows for in…
…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

Norman Maurer
Move encode of chunked content to an extra method, this allows for in…
…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

This comment has been minimized.

Show comment
Hide comment
@jestan

jestan Sep 5, 2013

Member

Nice findings @normanmaurer :)

Member

jestan commented Sep 5, 2013

Nice findings @normanmaurer :)

@CodeMason

This comment has been minimized.

Show comment
Hide comment
@CodeMason

CodeMason 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/netty/netty/issues/1812#issuecomment-23861940
.

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/netty/netty/issues/1812#issuecomment-23861940
.

@tsingxu

This comment has been minimized.

Show comment
Hide comment
@tsingxu

tsingxu Sep 8, 2013

Contributor

how interesting

Contributor

tsingxu commented Sep 8, 2013

how interesting

normanmaurer pushed a commit that referenced this issue Oct 23, 2013

@normanmaurer normanmaurer referenced this issue Oct 27, 2013

Closed

4.0 #1954

normanmaurer pushed a commit that referenced this issue Nov 7, 2013

Norman Maurer
Fix regression which lead to leak buffers when nothing could be read …
…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

Norman Maurer
Fix regression which lead to leak buffers when nothing could be read …
…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