From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.user,gmane.lisp.guile.devel Subject: Re: Python-on-guile Date: Sun, 25 Apr 2021 10:46:28 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13653"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user , guile-devel To: Mikael Djurfeldt Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Apr 25 10:47:03 2021 Return-path: Envelope-to: guile-user@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 1laaPu-0003Pz-Ga for guile-user@m.gmane-mx.org; Sun, 25 Apr 2021 10:47:02 +0200 Original-Received: from localhost ([::1]:59552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laaPt-0001Sp-6g for guile-user@m.gmane-mx.org; Sun, 25 Apr 2021 04:47:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laaPg-0001SI-Ho; Sun, 25 Apr 2021 04:46:48 -0400 Original-Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:43707) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laaPc-0003Eo-1f; Sun, 25 Apr 2021 04:46:48 -0400 Original-Received: by mail-pl1-x62c.google.com with SMTP id v20so82683plo.10; Sun, 25 Apr 2021 01:46:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CltBlYYplDaMAfBJ9DAAqYS3LdD3jCJa4wlm1Vg0N1w=; b=eNbMg083SwemMU+gLi/PNlvUaDkS4t2IrsQ48OrdwKbwJVQ1myDrjWiJaGJr79SEyK JUu1+pPB0Vd/3sgEvbY/KBEJIMUA5WQBQ8g0nkNgX5kBinTyMBBNJ64hx6lstzk6rBVQ eGUemzaoAyTb7/0quMF4/UcqIpqEhMPr0u9UkaxreSywwuglkvyn42C+NKyig4uOsgBA omUvaipLAwMr+nHHvbU5Xy/IV7dfdJ6znwE0CItdcnkrZaZagc3lDoi3avwfQqP7fulv iTrlOeak69/U2+M3nhSlhLRXk3c9/g0mK5+W+kYJt+dnqh1AoYn7N0PcnN/2Lmtl9y+4 GF2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CltBlYYplDaMAfBJ9DAAqYS3LdD3jCJa4wlm1Vg0N1w=; b=s+CmEss7beFhgRHaC1jot5eUmzTcHEyPysAxqzVLdLg4nVZNRrKoIjGhrLU1WNGdUF LwYp23R/Y9dldWmNjSUWwoOSp2vQ7vRf7WClwss+Ws1OHnwEt2qTvOgapcluzuQG+OB9 iv3LShE1bcMYAzaBaXPPV2Wx5v7SrsiGEHUoOkQ2pfOfajCEIkpTbVi6E3d4ODOyKuhP 3ia2/Ig5O4/yBhthV3LW+B45WvOPBWznUZUGcQxNXsoov14Hey5DDEiZjgOCk2yXvMmU sJL9rPQ+U73i2R2a/fPP+OLqJ/lmjb6jag4NXd73NS9X0vSTQXyGLXILhhOmqw6TaqEw l1Eg== X-Gm-Message-State: AOAM533ZTFfYpUUmbMBbVUm4JhoQvaytPh7BX1Cpz1WPqx1uEuwkDrw1 4FbHaBJSxEpREp4rkJinAD/dCcPWKtfBd+/kH/zLf/Hn X-Google-Smtp-Source: ABdhPJy25rO4QY4gEkAQSQ51JVo7ET1NrS4R329idQov1bT9fgW/cQrrVxt9iZOaJup5208OaqL3MBp+U6SNM+W97kM= X-Received: by 2002:a17:90a:2e03:: with SMTP id q3mr10463714pjd.206.1619340399945; Sun, 25 Apr 2021 01:46:39 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=stefan.itampe@gmail.com; helo=mail-pl1-x62c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, HTML_MESSAGE=0.001, 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-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17450 gmane.lisp.guile.devel:20750 Archived-At: The remaining 3x between guile and python can be to either the extensive usage of set! in python or if the number of runs in the inner loop is small because there is a let/ec for the break and according to the standard a catch to support the raising of StopIteration. Set! probably cannot account for 3x speedwise, but it may hinder optimisations that may yield a speedup of that factor. On Sat, Apr 24, 2021 at 5:19 PM Stefan Israelsson Tampe < stefan.itampe@gmail.com> wrote: > Guile is 3x faster then fastest python-on-guile which is 2x faster then > python3 Cpython > > attached is a guile corresponding program. > > On Sat, Apr 24, 2021 at 4:41 PM Stefan Israelsson Tampe < > stefan.itampe@gmail.com> wrote: > >> To note is that 'continue' is killing performance for python-on-guile >> programs, so by changing the >> code to not use continue lead to python-on-guile running twice the speed >> of python3. The reason is that >> the while loop is used as >> (while (...) >> (let/ec continue >> ...)) >> >> And the let/ec is probably not optimally compiled. Python-on-guile will >> check the loop for continue usage and if not then it will skip the let/ec. >> >> I attached the code not using continue >> >> On Sat, Apr 24, 2021 at 2:59 PM Stefan Israelsson Tampe < >> stefan.itampe@gmail.com> wrote: >> >>> Actually changing in (language python compile), >>> >>> (define (letec f) >>> (let/ec x (f x)))) >>> >>> To >>> >>> (define-syntax-rule (letec f) >>> (let/ec x (f x)))) >>> >>> Actually lead to similar speeds as python3. >>> >>> >>> >>> On Sat, Apr 24, 2021 at 1:26 PM Stefan Israelsson Tampe < >>> stefan.itampe@gmail.com> wrote: >>> >>>> Pro tip, when running this on guile the scheme code that it compilse to >>>> is located in log.txt. >>>> If you ,opt the resulting code in a guile session you might be able to >>>> pinpoint issues that >>>> delays the code execution. >>>> >>>> On Sat, Apr 24, 2021 at 12:04 PM Mikael Djurfeldt >>>> wrote: >>>> >>>>> (I should perhaps add that my script doesn't benchmark the object >>>>> system but rather loops, conditionals and integer arithmetic.) >>>>> >>>>> Den fre 23 apr. 2021 17:00Mikael Djurfeldt >>>>> skrev: >>>>> >>>>>> Hi, >>>>>> >>>>>> Yesterday, Andy committed new code to the compiler, some of which >>>>>> concerned skipping some arity checking. >>>>>> >>>>>> Also, Stefan meanwhile committed something called "reworked object >>>>>> system" to his python-on-guile. >>>>>> >>>>>> Sorry for coming with unspecific information (don't have time to >>>>>> track down the details) but I noticed that my benchmark script written in >>>>>> Python, and which computes the 20:th Ramanujan number, now runs 60% faster >>>>>> than before these changes. >>>>>> >>>>>> This means that python-on-guile running on guile3 master executes >>>>>> python code only 2.6 times slower than the CPython python3 interpreter >>>>>> itself. :-) >>>>>> >>>>>> Have a nice weekend all, >>>>>> Mikael >>>>>> >>>>>>