From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] extend map-into Date: Wed, 09 Oct 2019 15:35:00 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="261975"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (berkeley-unix) Cc: Nicolas Petton , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 09 21:14:46 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iIHQ5-00161i-PF for ged-emacs-devel@m.gmane.org; Wed, 09 Oct 2019 21:14:45 +0200 Original-Received: from localhost ([::1]:54758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iIHQ4-0007Ra-DI for ged-emacs-devel@m.gmane.org; Wed, 09 Oct 2019 15:14:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41805) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iIDzT-0001CD-8z for emacs-devel@gnu.org; Wed, 09 Oct 2019 11:35:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iIDzR-0005x2-Q3 for emacs-devel@gnu.org; Wed, 09 Oct 2019 11:35:02 -0400 Original-Received: from mx.sdf.org ([205.166.94.20]:64437) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iIDzR-0005w2-Hc for emacs-devel@gnu.org; Wed, 09 Oct 2019 11:35:01 -0400 Original-Received: from sdf.org (IDENT:akrl@otaku.sdf.org [205.166.94.8]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id x99FZ0bJ002451 (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits) verified NO); Wed, 9 Oct 2019 15:35:00 GMT Original-Received: (from akrl@localhost) by sdf.org (8.15.2/8.12.8/Submit) id x99FZ0JS029678; Wed, 9 Oct 2019 15:35:00 GMT In-Reply-To: (Stefan Monnier's message of "Tue, 08 Oct 2019 16:23:33 -0400") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 205.166.94.20 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:240785 Archived-At: Stefan Monnier writes: >> I can tell you what I did just now and you tell me if it makes sense. >> I've created a function with as body an unrolled loop that calls 10000 >> times (map-into nil 'alist). >> Once byte compiled I've run it with the current map.el and then with the >> new one loaded. > > That sounds about right. Tho, you can also use something like > `benchmark` for that. > >> On my machine both versions runs in about the same time (~0.04-0.03 >> secs), if there's some difference for this simple test is just noise. > > 0.03 seconds is too small for a meaningful measure, in my experience, > I recommend you add 2 zeroes to the number of iterations to bring it > into the realm of "a few seconds". > > But, yes, there's a chance the difference is negligible (more time is > spent in the funcall/apply machinery itself and/or the hash lookup than > the specific computation of the "tag" used to index the hash-table, > which is the part that depends on the set of specializers used on > a particular argument of a generic function). > > > Stefan I've repeated the same test going up two magnitude orders (1000000 iterations). Still the execution time (~1.7secs) seems not distinguishable between the old and the implementation. For my curiosity I've also tried to run it using `benchmark-run-compiled' with a very similar execution time as result. I would have expected to have the unrolled version faster but apparently funcall is not the bottle-neck here. As usual when profiling guessing proves to be not a good idea. Bests Andrea -- akrl@sdf.org