Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3A9E410E04 for ; Sun, 30 Mar 2014 09:10:26 +0000 (UTC) Received: (qmail 65551 invoked by uid 500); 30 Mar 2014 09:10:20 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 65399 invoked by uid 500); 30 Mar 2014 09:10:18 -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 65372 invoked by uid 99); 30 Mar 2014 09:10:16 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Mar 2014 09:10:16 +0000 Date: Sun, 30 Mar 2014 09:10:16 +0000 (UTC) From: "Mikhail Mazursky (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (LANG-990) Avoid String allocation in StrBuilder.append(CharSequence) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LANG-990?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mikhail Mazursky updated LANG-990: ---------------------------------- Attachment: LANG-990-v3.patch > Avoid String allocation in StrBuilder.append(CharSequence) > ---------------------------------------------------------- > > Key: LANG-990 > URL: https://issues.apache.org/jira/browse/LANG-990 > Project: Commons Lang > Issue Type: Improvement > Components: lang.text.* > Affects Versions: 3.3.1 > Reporter: Mikhail Mazursky > Fix For: Patch Needed > > Attachments: LANG-990-v2.patch, LANG-990-v3.patch, LANG-990.patch > > > StrBuilder.append(CharSequence) and StrBuilder.append(CharSequence, int, int) can be optimized for the case when CharBuffer is passed. Current implementation calls toString() method that allocates a new String. In case when CharBuffer.hasArray() returns true the buffer-backing char array can be accessed directly to copy chars from it. > Also an instanceOf StrBuilder check can be added to StrBuilder.append(CharSequence) and StrBuilder.append(CharSequence, int, int) to avoid toString() in that case too (StrBuilder can be passed as CharSequence in some cases). -- This message was sent by Atlassian JIRA (v6.2#6252)