From: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
To: guile-devel <guile-devel@gnu.org>
Subject: speedup of modifying return values
Date: Wed, 29 Aug 2018 12:58:16 +0200 [thread overview]
Message-ID: <CAGua6m3D=DOo4-S+xJobiQJpFwnsHDyGKJ16aRPAoAVefTCkJA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 797 bytes --]
Hi all, I'm trying to make a python clone in guile. Currently the code is
slow and one of the reasons is the following,
in my pythoon
return 1,2
returns a (values 1 2) in order to get python and scheme to interoperate.
but for python if you use
x = 1,2
then x is the tupple '(1 2) and in guile it is 1. So therefore we wrap the
result for
x=f(10)
as
(set! x (call-with-values (lambda () (f x)) (case-lambda ((x) x) (x x))))
This can be compiled to efficient bytecode but is not done so in guile. In
stead a closure is created at each assignment site and creating ineficient
code.
Any ideas how to improve this (I don't want "return a,b" to mean (list a b)
which is a quick solution
if we want to just stay in python and not interoperate with scheme at all
on this level.
Regards
Stefan
[-- Attachment #2: Type: text/html, Size: 1116 bytes --]
next reply other threads:[~2018-08-29 10:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-29 10:58 Stefan Israelsson Tampe [this message]
2018-08-29 18:46 ` speedup of modifying return values Taylan Kammer
2018-08-29 20:54 ` Hans Åberg
2018-08-29 22:53 ` Matt Wette
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAGua6m3D=DOo4-S+xJobiQJpFwnsHDyGKJ16aRPAoAVefTCkJA@mail.gmail.com' \
--to=stefan.itampe@gmail.com \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).