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: Sat, 24 Apr 2021 16:41:39 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000ab9b8f05c0b8e930" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1663"; 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 Sat Apr 24 16:42:07 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 1laJTz-00009z-Dn for guile-user@m.gmane-mx.org; Sat, 24 Apr 2021 16:42:07 +0200 Original-Received: from localhost ([::1]:51450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laJTy-0000qF-CT for guile-user@m.gmane-mx.org; Sat, 24 Apr 2021 10:42:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37522) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laJTm-0000q6-Hk; Sat, 24 Apr 2021 10:41:54 -0400 Original-Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:47097) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laJTk-0002tw-FO; Sat, 24 Apr 2021 10:41:54 -0400 Original-Received: by mail-pj1-x1036.google.com with SMTP id u14-20020a17090a1f0eb029014e38011b09so2786641pja.5; Sat, 24 Apr 2021 07:41:51 -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=dFCJlfl5c+QtEPsOB22eJHzytshw0+WRUy7ZFGXzDAk=; b=lRsUo4kEoIwyggg0MNNbRtG/m7peeVAOkD2E8/Uc1AppmequwPNoQzxud+G3tI4BVL NTm7NZIG9mQEoqUWm8wsicj7nu5I+wktrtxdEqoChCr3TP24+Id8m7EGdKztzLKD18dj y5TdwKruOTZ2yMYCuua98u+9XxjIxx+XNesKAziJQNiiMw7nbKo+VEkGKeZyL2Y7pa9U kSbpqnZ0Z9kmo4cSgN3c9UPSObw06OxYZoKE7cIBaHTd6r9I61a9CCJXYRWY/DffRtx/ wl4oIiSiyMeNrotdQN34FYdcXxj2+qyEMgRFw4H424t+sQq2cS/TGUEx6Ny09e/UwEbh +CJg== 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=dFCJlfl5c+QtEPsOB22eJHzytshw0+WRUy7ZFGXzDAk=; b=pvQLFrvbxkFhXL8KQexdVataVdn3ttmBU51d5+//0feCJ6b2olu0/gZcFGvfJN0GnB 35+92ART94+TnpuXxdD/TKii/0se2a03kaL0uCW8mlC8zgyLGsEJYn9+mykkTw8mLu8S qSCHA3uYEmS1RqAe/T8VJpdq5Ooptro5g22unPf0EUuK3+q410P8RJgPBvM25ym0eb3U RjNCsk8i+GgNcpnoiwK3ZzBGQFPKVXQ8ma0v0VAnweiLumlqOyqZbLREllI7G94BopJF grpjil+q6fjxeUoutMkq8qzsyv3qToAOP17Jk2qW8HMMRMxABnRxC+HZaKRRkiZrdhAa Ixbw== X-Gm-Message-State: AOAM531OV3DyiBu3kENTFg7naNejQfJxDowBhauzOfCUyZjEJTj+VZ4x of/8pnyeIMxL0CL6V8CLVDKoKCg6ZsjO1vxgj/Qp09di X-Google-Smtp-Source: ABdhPJzKQPIrzDvh9QPn2UZylz2KOtOVoHRYWnFkodEIg3qZ2l5XiwxYZLaEBI5HhUD8NeUdU9t9FdXyJkbiqc4ZkJA= X-Received: by 2002:a17:90b:3796:: with SMTP id mz22mr11262193pjb.80.1619275310396; Sat, 24 Apr 2021 07:41:50 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=stefan.itampe@gmail.com; helo=mail-pj1-x1036.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:17444 gmane.lisp.guile.devel:20747 Archived-At: --000000000000ab9b8f05c0b8e930 Content-Type: text/plain; charset="UTF-8" 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 >>>> >>>> --000000000000ab9b8f05c0b8e930 Content-Type: text/x-python; charset="US-ASCII"; name="ram.py" Content-Disposition: attachment; filename="ram.py" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_knvuoxlu0 IyAgcmFtYW51amFuLnB5IC0tIENvbXB1dGUgdGhlIE46dGggUmFtYW51amFuIG51bWJlcgojICAK IyAgQ29weXJpZ2h0IChDKSAyMDE4LTIwMjEgTWlrYWVsIERqdXJmZWxkdAojCiMgIFRoaXMgcHJv Z3JhbSBpcyBmcmVlIHNvZnR3YXJlOyB5b3UgY2FuIHJlZGlzdHJpYnV0ZSBpdCBhbmQvb3IgbW9k aWZ5CiMgIGl0IHVuZGVyIHRoZSB0ZXJtcyBvZiB0aGUgR05VIEdlbmVyYWwgUHVibGljIExpY2Vu c2UgYXMgcHVibGlzaGVkIGJ5CiMgIHRoZSBGcmVlIFNvZnR3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KiBiMCA8IHc6CiAgICAgICAg ICAgIGIwICs9IDEKICAgICAgICAgICAgCiAgICAgICAgYSA9IDEKICAgICAgICBhMyA9IDEKICAg ICAgICBiID0gYjAKICAgICAgICBiMyA9IGIwICogYjAgKiBiMAogICAgICAgIGNvdW50ID0gMCAj IG51bWJlciBvZiB3YXlzIHRvIHdyaXRlIHcKICAgICAgICB3aGlsZSBhIDw9IGI6CiAgICAgICAg ICAgIHMgPSBhMyArIGIzCiAgICAgICAgICAgIGlmIHMgPCB3OgogICAgICAgICAgICAgICAgYSAr PSAxICMgaWYgc3VtIGlzIHRvbyBzbWFsbCwgaW5jcmVhc2UgYQogICAgICAgICAgICAgICAgYTMg PSBhICogYSAqIGEKICAgICAgICAgICAgZWxpZiBzID09IHc6CiAgICAgICAgICAgICAgICBjb3Vu dCArPSAxICMgZm91bmQgYSBzdW0hCiAgICAgICAgICAgICAgICBpZiBjb3VudCA+IDE6CiAgICAg ICAgICAgICAgICAgICAgbiAtPSAxCiAgICAgICAgICAgICAgICAgICAgYnJlYWsKICAgICAgICAg ICAgICAgIGIgLT0gMSAjIGluY3JlYXNlIGIgYm90aCBpZiBzdW0gdG9vIGxhcmdlIGFuZCB0byBm aW5kIG5leHQgd2F5IHRvIHdyaXRlIHcKICAgICAgICAgICAgICAgIGIzID0gYiAqIGIgKiBiCiAg ICAgICAgICAgIGVsc2U6CiAgICAgICAgICAgICAgICBiIC09IDEgCiAgICAgICAgICAgICAgICBi MyA9IGIgKiBiICogYgogICAgICAgICAgICAgICAgCiAgICByZXR1cm4gdwoKcHJpbnQgKHJhbWFu dWphbiAoMjEpKQo= --000000000000ab9b8f05c0b8e930--