From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Gerd_M=c3=b6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Re: Bignum performance (was: Shrinking the C core) Date: Mon, 14 Aug 2023 09:35:08 +0200 Message-ID: <175cf474-29c8-a482-072e-0de784ac59e8@gmail.com> References: <87bkfartof.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24381"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Cc: incal@dataswamp.org, emacs-devel To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Aug 14 09:35:57 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qVS7J-00065s-3W for ged-emacs-devel@m.gmane-mx.org; Mon, 14 Aug 2023 09:35:57 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVS6f-00080h-PL; Mon, 14 Aug 2023 03:35:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qVS6c-00080U-6u for emacs-devel@gnu.org; Mon, 14 Aug 2023 03:35:14 -0400 Original-Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qVS6a-0004mf-Gn for emacs-devel@gnu.org; Mon, 14 Aug 2023 03:35:13 -0400 Original-Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-991c786369cso536230766b.1 for ; Mon, 14 Aug 2023 00:35:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691998510; x=1692603310; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=ZsPRWO6fenUwclzQK3euIPkmwqS87k3cS41jgpjVT8U=; b=STVikapt32QUi4xNQZL2zg28rbcHzy8s/oycz/ePQuITbIGkHZpMx/QgOAZ/Q+DYDg 4Y+fhEJiCUpkCdGvlMGk5A66/f6s+qCYHAOYyXVsHHctDhmA3byUEE3+tb2/0LMlKkxN 400yTm1ys6D0sSHhb8bBPSJTrmQLbFTswG86EOBwM3fZMCsNebZT5V/vjR2Rc3ctFc2V S6ZbAs8Ef/q1KSD5zDJrokFncKwkdpfopPYvV9O2PdSfLuICoxKPbfg/ib52cCn7Es/C CrHJkn4rDNcbUPqc8eVBpT6Lq5HxqmzyGRYguTYdAMebGVCFSZeuBUZSY3Z1HeqqIWtL vUjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691998510; x=1692603310; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZsPRWO6fenUwclzQK3euIPkmwqS87k3cS41jgpjVT8U=; b=OCEImp8s0rhqdRQRoMwxBDYUt3YAhIVh98cD9P3o/Z5OfitsJRgXnaavew8xTbkTj3 +l+7fJlLuIQGePbaD6vDI/YLzHh9BMx9MNd33EIxiwnLgCBNFYzarHENaDNVHdwioJcl v3gXHlcTkXR1JVepphhPsZJOYTp56x2HRn1qFFWVGXv0ovS1uvHTF5okWQ0sHyaq+b6U Al7LN5t59AGdpfqfYDrLJ52xNMUhBJJhJFzLMIKb+AT98sxHz5yPQS/Nq4ZZbMrjXw8K WSVu5+/4x5rtoCKMWmauaf5dzBsRyJnAJ+2V1InInAdORnr+THIhrm5o5svwH4y4ivll MGjw== X-Gm-Message-State: AOJu0YyLWNw9/XUMtW6TCfq2XiFTo/URdJo1iN6QLOHlSEGfkE62luRs JmPMFSX48oGP+PXKsptKOKmgtJXMhNI= X-Google-Smtp-Source: AGHT+IES2CeVl2ujdXqZ1KpXeeglavaV4UHVJQPD756h3ttO/JUd8tVSrBsjgIBmIxxCiJ/U5OSRgw== X-Received: by 2002:a17:906:104e:b0:99c:ae06:918f with SMTP id j14-20020a170906104e00b0099cae06918fmr7181323ejj.38.1691998510373; Mon, 14 Aug 2023 00:35:10 -0700 (PDT) Original-Received: from [192.168.178.21] (p4fe3a81e.dip0.t-ipconnect.de. [79.227.168.30]) by smtp.gmail.com with ESMTPSA id p5-20020a17090635c500b00997d7aa59fasm5443742ejb.14.2023.08.14.00.35.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Aug 2023 00:35:09 -0700 (PDT) Content-Language: en-US In-Reply-To: <87bkfartof.fsf@localhost> Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=gerd.moellmann@gmail.com; helo=mail-ej1-x630.google.com X-Spam_score_int: -64 X-Spam_score: -6.5 X-Spam_bar: ------ X-Spam_report: (-6.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, NICE_REPLY_A=-4.359, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:308706 Archived-At: On 14.08.23 09:04, Ihor Radchenko wrote: > Gerd Möllmann writes: > >>> Just for the record, SBCL/CMUCL don't use GMP. >> >> Hm, thinking of this - did someone measure how much time is spent in >> malloc/realloc/free in the benchmarks? That is what GMP uses, and SBCL >> doesn't. > > https://yhetil.org/emacs-devel/87bkfdsmde.fsf@localhost/ > > We can further get rid of the GC by temporarily disabling it (just for > demonstration): > > (let ((beg (float-time))) > (setq gc-cons-threshold most-positive-fixnum) > (fib 10000 1000) > (message "%.3f s" (- (float-time) beg)) ) > > perf record ~/Git/emacs/src/emacs -Q -batch -l /tmp/fib.eln > 0.739 s > > 17.11% emacs libgmp.so.10.5.0 [.] __gmpz_sizeinbase > 7.35% emacs libgmp.so.10.5.0 [.] __gmpz_add > 6.51% emacs emacs [.] arith_driver > 6.03% emacs libc.so.6 [.] malloc > 5.57% emacs emacs [.] allocate_vectorlike > 5.20% emacs [unknown] [k] 0xffffffffaae01857 > 4.16% emacs libgmp.so.10.5.0 [.] __gmpn_add_n_coreisbr > 3.72% emacs emacs [.] check_number_coerce_marker > 3.35% emacs fib.eln [.] F666962_fib_0 > 3.29% emacs emacs [.] allocate_pseudovector > 2.30% emacs emacs [.] Flss Hm, then maybe we can look at the disassembly of then benchmark in SBCL? Not that in the end the compiler is so smart that it optimizes a lot of stuff simply away because it can prove that the result of the computations cannot possibly be observed?