- Dump all required library cache
- Doing the same as precompiled files
Dumping cache file is not a good solution so I want to discard it. To do so, second solution must support macro translation. The challenge of doing it is that macro contains shared structures and may contain subrs (Scheme procedures defined in C). Translating shared structure to C may not be so difficult but subrs. Subrs themselves don't have any information where it's defined, so they only have their name and C pointer. As far as I know, there's no subr in macro so this may not be a problem as long as users (me mostly) don't do some black magic (and I know I can...).
One of the benefits (or maybe this is the only) of translating C is that considerably short amount of starting time. Sagittarius is, unfortunately, not so fast implementation, and its starting time is not so fast even when it loads only cached libraries. For example, one of my daily routine scripts takes 500ms to just showing help message (8000ms if it's not cached) and translated version takes 130ms. It's not that much difference (yet) but still it's almost 5 times faster than raw Scheme.
However, I think it's still slow or doing some unnecessary things. Consider the following script:
(import (rnrs)) (define (main args) (display args) (newline))If I run this script, then it loads 32 libraries currently. But the only bindings required in this script are
display
and newline
. So if the C translator is smart enough to detect them, then the result script should look like this:
;; imaginary script... (define (main args) (#{(core)#display} args) (#{(core)#newline}))Then it doesn't require any unnecessary library loading.
Hmm, I think I have a lot to do.
No comments:
Post a Comment