Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 950B32009F5 for ; Sun, 8 May 2016 11:11:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 93B0B160A06; Sun, 8 May 2016 09:11:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DBDF81609A8 for ; Sun, 8 May 2016 11:11:13 +0200 (CEST) Received: (qmail 70295 invoked by uid 500); 8 May 2016 09:11:13 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 70282 invoked by uid 99); 8 May 2016 09:11:13 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 May 2016 09:11:13 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id CDED92C14F8 for ; Sun, 8 May 2016 09:11:12 +0000 (UTC) Date: Sun, 8 May 2016 09:11:12 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LANG-1218) EqualsBuilder.append(Object,Object) is too big to be inlined, which prevents whole builder to be scalarized MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sun, 08 May 2016 09:11:14 -0000 [ https://issues.apache.org/jira/browse/LANG-1218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15275525#comment-15275525 ] ASF GitHub Bot commented on LANG-1218: -------------------------------------- GitHub user marschall opened a pull request: https://github.com/apache/commons-lang/pull/138 LANG-1218 EqualsBuilder.append is too large EqualsBuilder.append(Object, Object) is 327 bytes which is 2 bytes above the default inline limit of 325 of HotSpot (MaxInlineSize). Micro benchmarking has shown this can have a significant performance impact. Currently EqualsBuilder can be two to three times slower than writing the equals method "by hand". Once the method is small enough to be inlined EqualsBuilder has more or less the same performance as writing the equals method "by hand". There are different ways to push the method under the the inline limit. I decided to factor out the array handing of append(Object, Object) into a method. This leaves the body of append(Object, Object) to do what I presume is the common case, the non-array case. Issue: LANG-1218 https://issues.apache.org/jira/browse/LANG-1218 You can merge this pull request into a Git repository by running: $ git pull https://github.com/marschall/commons-lang LANG-1218 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/138.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #138 ---- commit 8558cb2425ae073d1f441176761791f38d687177 Author: Philippe Marschall Date: 2016-05-08T09:03:05Z LANG-1218 EqualsBuilder.append is too large EqualsBuilder.append(Object, Object) is 327 bytes which is 2 bytes above the default inline limit of 325 of HotSpot (MaxInlineSize). Micro benchmarking has shown this can have a significant performance impact. Currently EqualsBuilder can be two to three times slower than writing the equals method "by hand". Once the method is small enough to be inlined EqualsBuilder has more or less the same performance as writing the equals method "by hand". There are different ways to push the method under the the inline limit. I decided to factor out the array handing of append(Object, Object) into a method. This leaves the body of append(Object, Object) to do what I presume is the common case, the non-array case. Issue: LANG-1218 https://issues.apache.org/jira/browse/LANG-1218 ---- > EqualsBuilder.append(Object,Object) is too big to be inlined, which prevents whole builder to be scalarized > ----------------------------------------------------------------------------------------------------------- > > Key: LANG-1218 > URL: https://issues.apache.org/jira/browse/LANG-1218 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* > Affects Versions: 3.4 > Reporter: Ruslan Cheremin > > Method EqualsBuilder.append(Object,Object) is 327 bc long, while current JIT hot methods inlining threshold (-XX:FreqInlineSize) = 325. Because of this, .append(Object,Object) is not inlined: with -XX:+PrintInlining -XX:+PrintCompilation following messages could be seen > {noformat} > .... > @ 13 o.a.c.l.b.EqualsBuilder::append (327 bytes) hot method too big > .... > {noformat} > Fail of inlining, by itself, is not so bad -- just a bit penalty to performance. But crucial thing here: without all method being inlined Escape Analysis also fails to trace Builder instance lifespan, and fails to prove it NoEscape. This, in turn, leads EqualsBuilder to be really allocated on heap. > The funny thing here is: with .append(O,O) being just 2-3 bytecodes smaller, most of EqualsBuilder usage scenarios will be scalarized -- This message was sent by Atlassian JIRA (v6.3.4#6332)