From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32048 invoked by alias); 20 Mar 2018 14:14:09 -0000 Mailing-List: contact gdb-testers-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-testers-owner@sourceware.org Received: (qmail 32005 invoked by uid 89); 20 Mar 2018 14:14:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: kwanyin.sergiodj.net Received: from kwanyin.sergiodj.net (HELO kwanyin.sergiodj.net) (158.69.185.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 20 Mar 2018 14:14:05 +0000 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [binutils-gdb] Replace the linear search in find_pc_sect_line with a binary search. From: sergiodj+buildbot@sergiodj.net To: gdb-testers@sourceware.org Message-Id: <4ee89e903de920496a69c01df70db13a70a2a0be@gdb-build> Date: Tue, 20 Mar 2018 14:14:00 -0000 X-SW-Source: 2018-q1/txt/msg06495.txt.bz2 *** TEST RESULTS FOR COMMIT 4ee89e903de920496a69c01df70db13a70a2a0be *** Author: Stephen Roberts Branch: master Commit: 4ee89e903de920496a69c01df70db13a70a2a0be Replace the linear search in find_pc_sect_line with a binary search. This patch addresses slowness when setting breakpoints, especially in heavily templatized code. Profiling showed that find_pc_sect_line in symtab.c was the performance bottleneck. The original logic performed a linear search over ordered data. This patch uses a binary search, as suggested by comments around the function. There are no behavioural changes, but gdb is now faster at setting breakpoints in template code. Tested using on make check on an x86 target. The optimisation speeds up the included template-breakpoints.py performance test by a factor of 7 on my machine. ChangeLog: 2018-03-20 Stephen Roberts * gdb/symtab.c (find_pc_sect_line): now uses binary search. gdb/testsuite/ * gdb.perf/template-breakpoints.cc: New file. * gdb.perf/template-breakpoints.exp: New file. * gdb.perf/template-breakpoints.py: New file.