From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 51442 invoked by alias); 16 May 2017 17:51:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 51428 invoked by uid 89); 16 May 2017 17:51:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 May 2017 17:51:54 +0000 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v4GHSeQ7010000 for ; Tue, 16 May 2017 13:51:55 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ag3qc9u3j-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 16 May 2017 13:51:55 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 16 May 2017 18:51:54 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 16 May 2017 18:51:51 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v4GHppHX19136626; Tue, 16 May 2017 17:51:51 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7561452045; Tue, 16 May 2017 17:49:08 +0100 (BST) Received: from oc1027705133.ibm.com (unknown [9.152.212.109]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 5678B5204E; Tue, 16 May 2017 17:49:08 +0100 (BST) From: Andreas Arnez To: Yao Qi Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v2 12/19] read/write_pieced_value: Drop 'buffer_size' variable References: <1494352015-10465-1-git-send-email-arnez@linux.vnet.ibm.com> <1494352015-10465-13-git-send-email-arnez@linux.vnet.ibm.com> <86efvoao7c.fsf@gmail.com> Date: Tue, 16 May 2017 17:51:00 -0000 In-Reply-To: <86efvoao7c.fsf@gmail.com> (Yao Qi's message of "Tue, 16 May 2017 15:08:55 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 x-cbid: 17051617-0016-0000-0000-000004A0073F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17051617-0017-0000-0000-000027B11BE7 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-16_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705160139 X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg00354.txt.bz2 On Tue, May 16 2017, Yao Qi wrote: > Andreas Arnez writes: > > Patch is good to me, a nit below, > >> @@ -1806,12 +1805,8 @@ read_pieced_value (struct value *v) >> this_size_bits = max_offset - offset; >> >> this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8; >> + buffer.reserve (this_size); > > I noticed that buffer is only used within the for loop, so probably we > can move it into the loop, and do "std::vector buffer (this_size);" I thought there might be a slight performance benefit in keeping the buffer variable across loop iterations and just '.reserve' more space when needed. This was probably the original intention as well. -- Andreas