From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117559 invoked by alias); 27 Oct 2016 14:28:52 -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 116182 invoked by uid 89); 27 Oct 2016 14:28:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=upcoming X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Oct 2016 14:28:49 +0000 Received: by simark.ca (Postfix, from userid 33) id 53A8F1E127; Thu, 27 Oct 2016 10:28:48 -0400 (EDT) To: Tim Wiederhake Subject: Re: [PATCH 3/7] btrace: Use binary search to find instruction. X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 27 Oct 2016 14:28:00 -0000 From: Simon Marchi Cc: gdb-patches@sourceware.org, palves@redhat.com, markus.t.metzger@intel.com In-Reply-To: <1477549711-2603-4-git-send-email-tim.wiederhake@intel.com> References: <1477549711-2603-1-git-send-email-tim.wiederhake@intel.com> <1477549711-2603-4-git-send-email-tim.wiederhake@intel.com> Message-ID: <32eeec01cc2ddc61dcb90caab5a6e645@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.2 X-IsSubscribed: yes X-SW-Source: 2016-10/txt/msg00756.txt.bz2 On 2016-10-27 02:28, Tim Wiederhake wrote: > Currently, btrace_find_insn_by_number will iterate over all function > call > segments to find the one that contains the needed instruction. This > linear > search is too slow for the upcoming Python bindings that will use this > function to access instructions. This patch introduces a vector in > struct > btrace_thread_info that holds pointers to all recorded function > segments and > allows to use binary search. > > The proper solution is to turn the underlying tree into a vector of > objects > and use indices for access. This requires more work. A patch set is > currently being worked on and will be published later. Hi Tim, Unless you expect to backport this patch in the 7.12 branch (which I don't think is the case here), you can use C++ standard containers and functions. Specifically, std::vector instead of DEF_VEC, and probably std::lower_bound (if I understand correctly what the code is doing). Also, since we now have btrace_function pointers in a sorted vector, do we still need them to be linked together as a linked list? Simon