On Sun, 17 Oct 2004 13:04:14 +0200, Jens Axel Søgaard wrote:
> "A Hacker's Introduction to Partial Evaluation" by Darius Bacon might give
> some inspiration:
>>> <http://www.lisp-p.org/htdocs/peval/peval.cgi>
very nice article indeed.
I'd like to learn/try the partial evaluation approach to generate fast
matrix / image processing operations. i have some experience doing that in
c using cpp and inline functions, and a friend of mine wrote a library
doing the same stuff, again (ab)using inline directives, but it just feels
wrong (code smells?).
The problem: say, image effect is described as a superposition of
primitive effects, simplest way to implement it would be to apply each to
the result of the previous. then all you need is a bunch of primitive
effect procedures. But often it is faster to combine several
pixel / scan line operations in one loop what simple approach does not
allow (among other things to minimise memory access)
constructing a pixel / scan line function and passing it to generic "image
loop" is still slow, because of function calls overhead inside the loop.
that's where we start inlining and macroing. and in c it just looks
extremely ugly.
Now my questions are:
- does it make sense to use scheme to implement specialised mini-language
for this domain?
- I'd like the compiler for my mini-language to dump C code to C-compiler
and then some other bit of code load the build dynamic library and make
the exported function(s) available to the C bits of the application (which
is written in a mixture of C and PLT scheme). Are there any tools to help
me with that? I'm afraid mzc isn't the right tool because it builds PLT
aware routines to be called from scheme [right?]
--
gr{oe|ee}t{en|ings}
artm