* GOOPS Slowness (make <generic>)
@ 2003-10-26 16:57 Andreas Rottmann
0 siblings, 0 replies; only message in thread
From: Andreas Rottmann @ 2003-10-26 16:57 UTC (permalink / raw)
Hi!
Investigating why the guile-gobject GTK+2 bindings take so long to
load, I found out the following interesting fact, which is a reason
for part of the slowness, as the benchmark shows.
;; -*- Mode: scheme; -*-
(use-modules (oop goops))
(with-benchmark-prefix "make <generic>"
(benchmark "plain" 10000
(make <generic>))
(benchmark "with name" 10000
(make <generic> #:name 'a-gf)))
On my Athlon 900, I get this results (using Guile from current CVS):
andy@ivanova:~/src/foreign/guile/guile-core/benchmark-suite% GUILE_LOAD_PATH=.. ./guile-benchmark --benchmark-suite=`pwd` benchmarks/goops.bm
;; calibrating the benchmarking framework...
;; framework time per iteration: 2.11715698242188e-6
("benchmarks/goops.bm: make <generic>: plain" 10000 user 0.47 benchmark 0.448828430175781 bench/interp 0.338828430175781 gc 0.11)
("benchmarks/goops.bm: make <generic>: with name" 10000 user 10.68 benchmark 10.6588284301758 bench/interp 10.3588284301758 gc 0.3)
This means that generic function creation with specifing the #:name
keyword is slower by a factor of 20 (!), when I read the above
right. After peeking into oop/goops.scm a bit I discovered the
following:
(define-method (initialize (generic <generic>) initargs)
(let ((previous-definition (get-keyword #:default initargs #f))
(name (get-keyword #:name initargs #f)))
(next-method)
(slot-set! generic 'methods (if (is-a? previous-definition <procedure>)
(list (make <method>
#:specializers <top>
#:procedure
(lambda l
(apply previous-definition
l))))
'()))
(if name
(set-procedure-property! generic 'name name))
))
It seems that either set-procedure-property! or get-keyword is
probably the culprit, however, I'm not a Guile hacker...
Regards, Andy
--
Andreas Rottmann | Rotty@ICQ | 118634484@ICQ | a.rottmann@gmx.at
http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
Fingerprint | DFB4 4EB4 78A4 5EEE 6219 F228 F92F CFC5 01FD 5B62
Say NO to Software Patents! -- http://petition.eurolinux.org/
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-10-26 16:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-26 16:57 GOOPS Slowness (make <generic>) Andreas Rottmann
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).