From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1457 invoked by alias); 15 Jun 2009 13:20:15 -0000 Received: (qmail 1446 invoked by uid 22791); 15 Jun 2009 13:20:14 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 15 Jun 2009 13:20:07 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id B968129000F; Mon, 15 Jun 2009 15:20:04 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vSM5-2IKOaFU; Mon, 15 Jun 2009 15:20:03 +0200 (CEST) Received: from ulanbator.act-europe.fr (ulanbator.act-europe.fr [10.10.1.67]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id D5E76290003; Mon, 15 Jun 2009 15:20:02 +0200 (CEST) Cc: binutils@sourceware.org Message-Id: From: Tristan Gingold To: Dongsheng Xing In-Reply-To: <529129.60712.qm@web43401.mail.sp1.yahoo.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Subject: Re: [PATCH] Use binary search instead of linear search in corefile.c of gprof Date: Mon, 15 Jun 2009 13:20:00 -0000 References: <529129.60712.qm@web43401.mail.sp1.yahoo.com> X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00221.txt.bz2 On Jun 15, 2009, at 3:11 PM, Dongsheng Xing wrote: > > Hi! > > This patch replace linear search by binary search in > core_create_syms_from(). > > This is implemented by qsort(symbol_map) in > read_function_mappings() by function name, thus we can do binary > search in core_create_function_syms() based on function name. Just being curious: if you sort with qsort(), why don't you search with bsearch() ?