From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99694 invoked by alias); 1 Aug 2017 09:54:01 -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 99658 invoked by uid 89); 1 Aug 2017 09:53:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 01 Aug 2017 09:53:58 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id v719rp0Y010529 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 1 Aug 2017 05:53:56 -0400 Received: by simark.ca (Postfix, from userid 112) id BD5D41EA05; Tue, 1 Aug 2017 05:53:51 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 15B281E5AF; Tue, 1 Aug 2017 05:53:51 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 01 Aug 2017 09:54:00 -0000 From: Simon Marchi To: Sergio Durigan Junior Cc: GDB Patches , Pedro Alves , Eli Zaretskii Subject: Re: [PATCH v2] Implement the ability to set/unset environment variables to GDBserver when starting the inferior In-Reply-To: <87shhc9ffa.fsf@redhat.com> References: <20170629194106.23070-1-sergiodj@redhat.com> <20170727033531.23066-1-sergiodj@redhat.com> <87shhc9ffa.fsf@redhat.com> Message-ID: <291aec4022448984a38891ddbccf08e1@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 1 Aug 2017 09:53:51 +0000 X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg00005.txt.bz2 On 2017-08-01 04:42, Sergio Durigan Junior wrote: >> I have the feeling that we can reduce the amount of boilerplate code >> in the set and unset methods by using std::set instead of std::vector. >> Performance-wise this may not be very good, since for any reasonable >> amount of variables, the vector would probably be more efficient. But >> its interface makes the code clearer and lighter, in my opinion. I >> suppose we could always make something with a set-like interface and >> behavior implemented on top of a vector. > > I thought about using std::set, but given that I was recently called > out > for doing "premature pessimization", I chose to stick with std::vector. > I agree that for some cases std::set would make things easier to > implement/understand. Yeah, the thing with std::set that simplifies the code is its interface, not its implementation. And it would indeed not be a good idea performance-wise (both CPU cycles and memory) to use std::set for something that would typically contain a handful of elements at the most. So that's why I think using something that has (part of) the interface of an std::set but implemented on top of an std::vector would be good. I'll try to prototype something soon. Simon