From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mikael Djurfeldt Newsgroups: gmane.lisp.guile.user,gmane.lisp.guile.devel Subject: Re: Python-on-guile Date: Sun, 25 Apr 2021 10:20:24 +0200 Message-ID: References: Reply-To: mikael@djurfeldt.com 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="15126"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user , guile-devel To: Stefan Israelsson Tampe Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Apr 25 10:20:58 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 1laa0f-0003nU-UZ for guile-user@m.gmane-mx.org; Sun, 25 Apr 2021 10:20:57 +0200 Original-Received: from localhost ([::1]:55960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laa0e-00079U-O8 for guile-user@m.gmane-mx.org; Sun, 25 Apr 2021 04:20:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laa0P-00079L-UD; Sun, 25 Apr 2021 04:20:41 -0400 Original-Received: from mail-ua1-f49.google.com ([209.85.222.49]:45899) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laa0N-0003fP-G9; Sun, 25 Apr 2021 04:20:41 -0400 Original-Received: by mail-ua1-f49.google.com with SMTP id z34so122960uac.12; Sun, 25 Apr 2021 01:20:36 -0700 (PDT) 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:reply-to :from:date:message-id:subject:to:cc; bh=qSWFZA7T+1FKRrDgCxPgNOJRHq4KjXKfYdudvzEkCMo=; b=gSg3txwlK0mXuuOyUXg9yKLH41onkJLGQNmyvxHgO1G4z20ypq/ZSQvcdHZyKjYxip sRnnjwUzmA08n6GVb6dY0Af2Lt7zIKlPyN6e/qJ6Y0CrjLmsmooKsiZjRWOsaXxrwlN8 R0DtiVfwgnhA8x6lJcUCoGWui0UO52+QjC37X3QywoUEjQOnCiPo9vDbWagBV+Sopl5e sRjQ623gZ9Pyn0u6SWj7VywqWESHTrV1LTUpvyJijOve4l+gabZq1tghU9DUCUK3WKdG Wq/cjAeLh7n8F6WvbtsPNx+yCcJCiMe+2Csp/VF8WpnUO8dL58YC9UB5agV2+XTm8k5M D9rA== X-Gm-Message-State: AOAM531vveeQs1vZLd1HIUsYwh0D0xicgq4d3N+RZjznTfw6e7Qvm/xj siq7sH+0fLCzKMr4bjAsZ6aQStZR29Nf/3Ca3qI= X-Google-Smtp-Source: ABdhPJx3lapXdxaDzX9eYo0Yg7w2XBU6r23EpAVPR8Z2/6LRlM2wVSTiTWOyiVvT7oYWVsuvOeV+7StXR1JzYDCQC/k= X-Received: by 2002:ab0:36db:: with SMTP id v27mr6944783uau.79.1619338835619; Sun, 25 Apr 2021 01:20:35 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=209.85.222.49; envelope-from=mdjurfeldt@gmail.com; helo=mail-ua1-f49.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:17449 gmane.lisp.guile.devel:20749 Archived-At: Nice! I guess it would be nice if "continue" *could* be compiled efficiently. And, as you indicate, perhaps that would amount to efficiently compiling let/ec. Best regards, Mikael 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 >>>>>> >>>>>>