From: Andy Wingo <wingo@pobox.com>
To: ludo@gnu.org (Ludovic Courtès)
Cc: guile-devel@gnu.org
Subject: Re: ‘map’ and ‘for-each’ written in Scheme
Date: Sun, 08 May 2011 17:31:23 +0200 [thread overview]
Message-ID: <m3iptl6wfo.fsf@unquote.localdomain> (raw)
In-Reply-To: <871v09dygz.fsf_-_@gnu.org> ("Ludovic Courtès"'s message of "Sun, 08 May 2011 17:05:32 +0200")
On Sun 08 May 2011 17:05, ludo@gnu.org (Ludovic Courtès) writes:
> Could you add benchmarks so we can see how the Scheme and C
> implementations compare?
Done.
Current Guile:
$ ./benchmark-guile srfi-1.bm
Benchmarking /home/wingo/src/guile/meta/guile ... srfi-1.bm
with GUILE_LOAD_PATH=/home/wingo/src/guile/benchmark-suite
;; running guile version 2.0.1.22-4cbd6
;; calibrating the benchmarking framework...
;; framework time per iteration: 5.72204532623291e-8
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling /home/wingo/src/guile/benchmark-suite/benchmarks/srfi-1.bm
;;; compiled /home/wingo/src/guile/cache/guile/ccache/2.0-LE-8-2.0/home/wingo/src/guile/benchmark-suite/benchmarks/srfi-1.bm.go
("srfi-1.bm: fold: big" 30 user 2.03 benchmark 2.0299982833864 bench/interp 2.0299982833864 gc 0.0)
("srfi-1.bm: fold: small" 2000000 user 1.54 benchmark 1.42555909347534 bench/interp 1.42555909347534 gc 0.0)
("srfi-1.bm: drop-while: big" 30 user 1.78 benchmark 1.7799982833864 bench/interp 1.7799982833864 gc 0.0)
("srfi-1.bm: drop-while: small" 2000000 user 1.38 benchmark 1.26555909347534 bench/interp 1.26555909347534 gc 0.0)
("srfi-1.bm: map: big" 30 user 4.55 benchmark 4.5499982833864 bench/interp 4.0847600543864 gc 0.465238229)
("srfi-1.bm: map: small" 2000000 user 3.2 benchmark 3.08555909347534 bench/interp 2.97014448647534 gc 0.115414607)
("srfi-1.bm: for-each: big" 30 user 2.96 benchmark 2.9599982833864 bench/interp 2.9599982833864 gc 0.0)
("srfi-1.bm: for-each: small" 2000000 user 2.34 benchmark 2.22555909347534 bench/interp 2.22555909347534 gc 0.0)
Guile 1.8:
$ /opt/guile-1.8/env ./benchmark-guile -i /opt/guile-1.8/bin/guile srfi-1.bm
Benchmarking /opt/guile-1.8/bin/guile ... srfi-1.bm
with GUILE_LOAD_PATH=/home/wingo/src/guile/benchmark-suite
ERROR: no code for module (benchmark-suite lib)
wingo@unquote:~/src/guile$ GUILE_LOAD_PATH=. /opt/guile-1.8/env ./benchmark-guile -i /opt/guile-1.8/bin/guile srfi-1.bm
Benchmarking /opt/guile-1.8/bin/guile ... srfi-1.bm
with GUILE_LOAD_PATH=/home/wingo/src/guile/benchmark-suite:.
;; running guile version 1.8.7
;; calibrating the benchmarking framework...
;; framework time per iteration: 9.5367431640625e-8
("srfi-1.bm: fold: big" 30 user 7.14 benchmark 7.13999713897705 bench/interp 3.72999713897705 gc 3.41)
("srfi-1.bm: fold: small" 2000000 user 6.07 benchmark 5.87926513671875 bench/interp 2.91926513671875 gc 2.96)
("srfi-1.bm: drop-while: big" 30 user 5.51 benchmark 5.50999713897705 bench/interp 2.92999713897705 gc 2.58)
("srfi-1.bm: drop-while: small" 2000000 user 3.18 benchmark 2.98926513671875 bench/interp 1.90926513671875 gc 1.08)
("srfi-1.bm: map: big" 30 user 7.93 benchmark 7.92999713897705 bench/interp 4.90999713897705 gc 3.02)
("srfi-1.bm: map: small" 2000000 user 4.04 benchmark 3.84926513671875 bench/interp 2.42926513671875 gc 1.42)
("srfi-1.bm: for-each: big" 30 user 5.35 benchmark 5.34999713897705 bench/interp 4.02999713897705 gc 1.32)
("srfi-1.bm: for-each: small" 2000000 user 3.22 benchmark 3.02926513671875 bench/interp 1.91926513671875 gc 1.11)
Map and for-each are slower than fold right now because they check for
circular lists. Dunno how useful that is, but it's what they always
have done.
Andy
--
http://wingolog.org/
next prev parent reply other threads:[~2011-05-08 15:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-05 15:24 early termination for `map' Andy Wingo
2011-05-05 15:56 ` Noah Lavine
2011-05-05 16:26 ` Ludovic Courtès
2011-05-05 18:40 ` Andy Wingo
2011-05-05 20:21 ` Ludovic Courtès
2011-05-05 21:12 ` Andy Wingo
2011-05-06 15:41 ` Ludovic Courtès
2011-05-08 15:05 ` ‘map’ and ‘for-each’ written in Scheme Ludovic Courtès
2011-05-08 15:31 ` Andy Wingo [this message]
2011-05-05 18:27 ` early termination for `map' Andy Wingo
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=m3iptl6wfo.fsf@unquote.localdomain \
--to=wingo@pobox.com \
--cc=guile-devel@gnu.org \
--cc=ludo@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).