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 17:19:25 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000c9154805c0b97092" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15432"; 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 17:20:18 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 1laK4w-0003uA-5W for guile-user@m.gmane-mx.org; Sat, 24 Apr 2021 17:20:18 +0200 Original-Received: from localhost ([::1]:60254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laK4v-00082V-4J for guile-user@m.gmane-mx.org; Sat, 24 Apr 2021 11:20:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laK4M-000823-6K; Sat, 24 Apr 2021 11:19:42 -0400 Original-Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:38703) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laK4J-0006MX-6Z; Sat, 24 Apr 2021 11:19:41 -0400 Original-Received: by mail-pg1-x534.google.com with SMTP id w10so789766pgh.5; Sat, 24 Apr 2021 08:19:38 -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=NzE8zO3CfLZC4wm1NkEILPmXV5ToGftfGzSWpii/sII=; b=HscKKur+LI/i3Fw108anvtnsRFZbsGSPgILFMnxb4x2b7wWPLd59xzLdScpS/txsGQ 9atQBBnG4vvtRxmK4PC8IBwy0i1PhdmfrDFvJ+7KCafpjUb5Lr8Z99ElGM6eEqra3qzE Ah5qP4xGI4IZoChc8bnAza9ztT8xuN88JFITcDpUPrY75QbmdqURPFN8K58VA37tuk0F gB6iHAF2UNYaL+194/RMZKRLMpvjhRZstwVxUdNk1rrTvzscomxEdFiWhd8PE9kDtg6c RVafv6VPnSMD+UDSVZliCD58nwsLC2tN/JSHDpVPRUXEZ7jbiGH+vkaKcYlJu10aKaxx bb5A== 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=NzE8zO3CfLZC4wm1NkEILPmXV5ToGftfGzSWpii/sII=; b=WxVZD5DizScDKEUu5Ph19KRTSXesNOo9SS2rzY89x12mJeIpdHca3nwcWf6yb8RMys ToIhSOCKEW+yc2fMIkr3oUow/WZ7MkKPPsp+/R1yTlwMU66Cv4z6SmmHLoF4bZ6l7ajD TqHzVzrdsGHNIHvc9nqSLIyHATNiJkOuZ0ywMx/ETXtlt5zjgJ7JM+3wzoxzLu59hNgl uOa0EMPAbESaZceQGZTLSyCVn+GrFgVruiyp6JsQBu2zEVDMO2g2zo40qekR4q6ff2vZ D/Bc5dYhU87r68z9pVDpR4usp6FbS5h84HoD0GnPgPU5gv3v/AuUVZkeHQ9OwVHHyEyH Oudg== X-Gm-Message-State: AOAM530yNpj2WaQtVpQ1+c6v/XWs2ysZf9XCFgJfHUsUFJcMId8srRrw BfDneZouic53qRaFiiRadY6uL8MSz+wxtsrapfuhbRDL X-Google-Smtp-Source: ABdhPJyIir4mPHc/zJPdtXExYnG7DdQUTpLfYPR9hy66onqqTp/0sjcJqW7LpzIs708TDobwhTP1YV8Rl82IVNAuBJA= X-Received: by 2002:a63:a26:: with SMTP id 38mr8826083pgk.279.1619277577252; Sat, 24 Apr 2021 08:19:37 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=stefan.itampe@gmail.com; helo=mail-pg1-x534.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:17445 gmane.lisp.guile.devel:20748 Archived-At: --000000000000c9154805c0b97092 Content-Type: text/plain; charset="UTF-8" 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 >>>>> >>>>> --000000000000c9154805c0b97092 Content-Type: text/x-scheme; charset="US-ASCII"; name="ram.scm" Content-Disposition: attachment; filename="ram.scm" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_knvw1tj00 KGRlZmluZSAocmFtYW51amFuICBuKQogIChsZXQgbHAgKCh3IDApIChiMCAxKSAobiBuKSkKICAg IChpZiAoPiBuIDApCiAgICAgICAgKGxldCAoKHcgKCsgdyAxKSkpCiAgICAgICAgICAobGV0IGxw MiAoKGIwIGIwKSkKICAgICAgICAgICAgKGlmICg8ICgrIDEgKCogYjAgYjAgYjApKSB3KQogICAg ICAgICAgICAgICAgKGxwMiAoKyBiMCAxKSkKICAgICAgICAgICAgICAgIChsZXQgbHAzICgoYSAx KSAoYTMgMSkgKGIgYjApIChiMyAoKiBiMCBiMCBiMCkpIChjb3VudCAwKSkKICAgICAgICAgICAg ICAgICAgKGlmICg8PSBhIGIpCiAgICAgICAgICAgICAgICAgICAgICAobGV0ICgocyAoKyBhMyBi MykpKQogICAgICAgICAgICAgICAgICAgICAgICAoY29uZAogICAgICAgICAgICAgICAgICAgICAg ICAgKCg8IHMgdykKICAgICAgICAgICAgICAgICAgICAgICAgICAobGV0ICgoYWEgKCsgYSAxKSkp CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAobHAzIGFhICgqIGFhIGFhIGFhKSBiIGIzIGNv dW50KSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAoKD0gcyB3KQogICAgICAgICAgICAgICAg ICAgICAgICAgIChsZXQgKChjb3VudCAoKyBjb3VudCAxKSkpCiAgICAgICAgICAgICAgICAgICAg ICAgICAgICAoaWYgKD4gY291bnQgMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAo bHAgdyBiMCAoLSBuIDEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChsZXQqICgo YiAgICgtIGIgMSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChiMyAg KCogYiBiIGIpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChscDMgYSBhMyBi IGIzIGNvdW50KSkpKSkKICAgICAgICAgICAgICAgICAgICAgICAgIChlbHNlCiAgICAgICAgICAg ICAgICAgICAgICAgICAgKGxldCogKChiICAgKC0gYiAxKSkKICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgKGIzICAoKiBiIGIgYikpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAg KGxwMyBhIGEzIGIgYjMgY291bnQpKSkpKQogICAgICAgICAgICAgICAgICAgICAgKGxwIHcgYjAg bikpKSkpKQogICAgICAgIHcpKSkKCihwayAocmFtYW51amFuIDIwKSkK --000000000000c9154805c0b97092--