mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
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.
This commit is contained in:
parent
a5f83fd21d
commit
3e414c302f
1 changed files with 22 additions and 2 deletions
|
@ -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))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue