From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 549 invoked by alias); 7 Sep 2009 22:21:26 -0000 Received: (qmail 541 invoked by uid 22791); 7 Sep 2009 22:21:25 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 07 Sep 2009 22:21:15 +0000 Received: (qmail 2425 invoked from network); 7 Sep 2009 22:21:14 -0000 Received: from unknown (HELO orlando) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 7 Sep 2009 22:21:14 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [RFA/PATCH] PR/9711: quadratic slowdown for deep stack traces Date: Mon, 07 Sep 2009 22:21:00 -0000 User-Agent: KMail/1.9.10 Cc: Joel Brobecker , Doug Evans References: <20090903183658.GJ4343@adacore.com> <200909072156.53133.pedro@codesourcery.com> <20090907220012.GK30677@adacore.com> In-Reply-To: <20090907220012.GK30677@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200909072321.12505.pedro@codesourcery.com> X-IsSubscribed: yes 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 X-SW-Source: 2009-09/txt/msg00175.txt.bz2 On Monday 07 September 2009 23:00:12, Joel Brobecker wrote: > > Hmmm, nowhere in the patch is the actual reason this is > > needed explained. Could you have some of that? > > Good idea, Pedro. How's the attached? > > + /* Try using the frame stash first. Finding it there removes the need > + to perform the search by looping over all frames, which can be very > + CPU-intensive if the number of frames is very high (the loop is O(n) > + and get_prev_frame performs a series of checks that are relatively > + expensive). This optimization is particularly useful when this function > + is called from another function which already loops over all frames, > + making the overall behavior O(n^2). */ Fine with me, although I wouldn't mind a reference to which is the the "another function" talked about here (--- my thinking is that it should be "easy" to get here when touching the problematic caller in question. If it is grep-easy, the merrier. If the reference in the comment ends up out-of-date at some point, then it just means the that a good time to rethink the stash as been reached). Just a "(see foo_func)" would be fine. Anyway, thanks! -- Pedro Alves