summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2009-03-08 16:38:51 +0100
committerLudovic Courtès <ludo@gnu.org>2009-03-08 16:38:51 +0100
commit3e414c302f5a6ee8618aa7f9b2bbd174ef7e9d31 (patch)
treeb09e00bdf4d2922c7307ed2bb91d02060a6ec076
parenta5f83fd21d29d07ddb005962b37412b1e9aa5ffa (diff)
downloadguile-3e414c302f5a6ee8618aa7f9b2bbd174ef7e9d31.tar.gz
Add new subr invocation benchmarks.
* benchmark-suite/benchmarks/subr.bm (hook1, hook3): New variables. ("subr invocation")("generic subr with rest arg", "generic subr with rest arg and 3+ parameters"): New benchmarks. ("subr application")("generic subr with rest arg", "generic subr with rest arg and 3+ parameters"): New benchmarks.
-rw-r--r--benchmark-suite/benchmarks/subr.bm24
1 files changed, 22 insertions, 2 deletions
diff --git a/benchmark-suite/benchmarks/subr.bm b/benchmark-suite/benchmarks/subr.bm
index fbb9ed386..9c87a9921 100644
--- a/benchmark-suite/benchmarks/subr.bm
+++ b/benchmark-suite/benchmarks/subr.bm
@@ -21,6 +21,9 @@
:use-module (benchmark-suite lib))
+(define hook1 (make-hook 1))
+(define hook3 (make-hook 3))
+
(with-benchmark-prefix "subr invocation"
(benchmark "simple subr" 700000
@@ -34,7 +37,18 @@
;; closures" (cclos). There, when a cclo/gsubr is called, the evaluator
;; goes through `SCM_APPLY ()' and conses the arguments, which is more
;; costly than the invocation of a "simple subr".
- (string= "foo" "bar")))
+ (string= "foo" "bar"))
+
+ (benchmark "generic subr with rest arg" 700000
+ ;; 1 required argument, 0 optional arguments, 1 rest.
+ (run-hook hook1 1))
+
+ (benchmark "generic subr with rest arg and 3+ parameters" 700000
+ ;; 1 required argument, 0 optional arguments, 1 rest.
+
+ ;; The evaluator considers calls with 3 and more parameters as a general
+ ;; form and always stores the arguments into a list.
+ (run-hook hook3 1 2 3)))
(with-benchmark-prefix "subr application"
@@ -43,4 +57,10 @@
(apply 1+ '(0)))
(benchmark "generic subr" 700000
- (apply string= "foo" '("bar"))))
+ (apply string= "foo" '("bar")))
+
+ (benchmark "generic subr with rest arg" 700000
+ (apply run-hook hook1 '(1)))
+
+ (benchmark "generic subr with rest arg and 3+ parameters" 700000
+ (run-hook hook3 1 2 '(3))))