From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Antipov Newsgroups: gmane.emacs.devel Subject: Re: Benchmarking temporary Lisp objects [Was: Re: [RFC] temporary Lisp_Strings] Date: Mon, 08 Sep 2014 16:01:43 +0400 Message-ID: <540D9AA7.5020205@yandex.ru> References: <5405BE5D.1090003@yandex.ru> <5405DE8B.4050201@yandex.ru> <5406EC21.4060200@yandex.ru> <5407281C.3090302@cs.ucla.edu> <54073621.2040403@yandex.ru> <540744F5.2010804@cs.ucla.edu> <5407F1B7.6090704@yandex.ru> <5407F4E6.2040809@cs.ucla.edu> <5407FDF4.7020504@yandex.ru> <54086B1A.8070506@yandex.ru> <54087B5E.10402@yandex.ru> <54088D63.8010406@cs.ucla.edu> <54093561.2010507@yandex.ru> <5409630B.6030201@cs.ucla.edu> <540D85E3.5090407@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1410177732 12111 80.91.229.3 (8 Sep 2014 12:02:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Sep 2014 12:02:12 +0000 (UTC) Cc: Emacs development discussions To: Stefan Monnier , Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 08 14:02:06 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XQxe0-00074P-L1 for ged-emacs-devel@m.gmane.org; Mon, 08 Sep 2014 14:02:04 +0200 Original-Received: from localhost ([::1]:42874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQxe0-0002iX-AF for ged-emacs-devel@m.gmane.org; Mon, 08 Sep 2014 08:02:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54946) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQxdq-0002hN-KC for emacs-devel@gnu.org; Mon, 08 Sep 2014 08:02:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XQxdj-0006ga-JE for emacs-devel@gnu.org; Mon, 08 Sep 2014 08:01:54 -0400 Original-Received: from forward10l.mail.yandex.net ([84.201.143.143]:37086) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQxdj-0006gN-9l for emacs-devel@gnu.org; Mon, 08 Sep 2014 08:01:47 -0400 Original-Received: from smtp13.mail.yandex.net (smtp13.mail.yandex.net [95.108.130.68]) by forward10l.mail.yandex.net (Yandex) with ESMTP id 33414BA13B9; Mon, 8 Sep 2014 16:01:45 +0400 (MSK) Original-Received: from smtp13.mail.yandex.net (localhost [127.0.0.1]) by smtp13.mail.yandex.net (Yandex) with ESMTP id 9D970E40063; Mon, 8 Sep 2014 16:01:44 +0400 (MSK) Original-Received: from unknown (unknown [37.139.80.10]) by smtp13.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id NpmIv9r5XX-1h68C5Dx; Mon, 8 Sep 2014 16:01:44 +0400 (using TLSv1.2 with cipher AES128-SHA (128/128 bits)) (Client certificate not present) X-Yandex-Uniq: 543e9a27-9fde-4f4d-a717-2a337fce651b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1410177704; bh=GRsn11nL3acLrYczyFZC6ZZtFJQg76vC1xy7AzRQ4xU=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=MKk0MFveOz4Qnsq39MWPXirv52YSVQwKrKSNziGgztJAl3iu2bM4OxTEPQ5+1xAU4 guLvr49Cr3oz9bEBHP2iXK19uXea94luDlqauqARBFGE2tC0kUF3UE21kMCycSwbSo ja44uITQG5BycZh/36Ibajh/bTM3nyGsreAZSuv4= Authentication-Results: smtp13.mail.yandex.net; dkim=pass header.i=@yandex.ru User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 In-Reply-To: <540D85E3.5090407@yandex.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 84.201.143.143 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:174080 Archived-At: On 09/08/2014 02:33 PM, Dmitry Antipov wrote: >> Basically, this risks making Elisp's semantics more murky, so it has to >> come with a good performance story. Here is a "real-life" example with my favorite benchmark running over xdisp.c: (defun scroll-up-benchmark () (interactive) (let ((oldgc gcs-done) (oldtime (float-time))) (condition-case nil (while t (scroll-up) (redisplay)) (error (message "GCs: %d Elapsed time: %f seconds" (- gcs-done oldgc) (- (float-time) oldtime)))))) ==> 401 GCs, ~29.9s. With two-lines change: === modified file 'src/textprop.c' --- src/textprop.c 2014-09-07 07:04:01 +0000 +++ src/textprop.c 2014-09-08 11:49:52 +0000 @@ -1319,7 +1319,8 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */) (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object) { - Fadd_text_properties (start, end, list2 (property, value), object); + Lisp_Object val = scoped_cons (property, scoped_cons (value, Qnil)); + Fadd_text_properties (start, end, val, object); return Qnil; } it shows 399 GCs and ~29.6s. Here we just allocate 2 cons cells (32 bytes on a 64-bit system) on stack, and can see a measurable performance improvement. I believe that carefully used stack allocation can give a much more visible improvement for a wide range of Lisp workloads. Dmitry