This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Unexec'ing Scwm [was Re: Proposal for a Guile binary file format]
Greg J. Badros writes:
> I'm not sure what you mean: "separate its guile-specific interface
> from r4rs code"?
this is only applicable if you use the module system, i think. in that
case, foo.scm would have
(define-module (foo) :use-module (hobbit4d link))
(hobbit-load-from-path 'foo-implementation)
(export ...)
and foo-implementation.scm would have hobbit-compilable (r4rs) code
only. the idea is similar to C programs: .h and .c files for interface
and implementation, respectively.
> That stuff is easy enough to tweak when people agree. I'll have to
> look at what thud does as an example. How much Scheme code do you
> compile into shared libraries and how much faster is loading those
> than loading the Scheme code directly?
currently one file (about 20 definitions) is compiled -- grep for
"simmath". see src/thud/impl/runtime.scm for the loading, and
src/thud/impl/com.scm for the definition of `thud-load-from-path'.
fwiw, wrt load-performance, here are some numbers and comments:
scheme-code directly: 5 ms
using shared lib: 22 this includes one-time overhead
of loading (hobbit4d link) runtime
which is shared for all libraries
loaded this way.
see below for modified `thud-load-from-path'. when i move loading of
(hobbit4d link) out of the accounting (not shown), the number is 18.
i must caution that these numbers are probably useless in determining
how things would behave for scwm, ymWv (W => will most definitely).
thi
--------------
(defmacro thud-load-from-path (file-name-snippet)
`(let ((start (get-internal-run-time)))
(if (string=? "" (%thud-config-info 'HOBBIT_ROOT))
(load-from-path (string-append ,file-name-snippet ".scm"))
(begin (use-modules (hobbit4d link))
(hobbit-load-from-path ,file-name-snippet)))
(let ((now (get-internal-run-time)))
(say ";;;;;; start" start "now" now "diff" (- now start)))))