[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "byte compilers, was address@hidden: dynamic loading of native code

From: Bill Schottstaedt
Subject: Re: "byte compilers, was address@hidden: dynamic loading of native code modules]
Date: Mon, 15 Apr 2002 06:27:44 -0700

With great hesitation and diffidence, on the subject of Guile
compilation, I can offer a simple "accelerator". For context,
in Snd (a sound editor), operations are on hundreds of millions,
occasionally billions of samples; the users are mostly impatient
musicians who view a sound editor as nothing but a necessary
evil; they are not the type that will wait on a multiply. In
95% of the cases in this context, a simple code walker can
ascertain in advance that a given operation (lambda form)
deals with simple data (i.e. floats or ints, not complex or
bignum), and has simple control structures.  So, I wrote a
little "byte compiler" of sorts that turns those expressions
into a list of function calls with all the variable/data
addresses precomputed and so on; the evaluator then gets
a pointer to that "parse tree", the current incoming arguments,
and does:

  while (!ALL_DONE)
      curfunc = prog->program[PC++];
      (*(curfunc->function))(curfunc->args, ints, dbls);

The code runs from 8 to 20 times faster than the Guile evaluator,
still 2 to 3 times slower than the equivalent compiled C code,
but better than 30 times slower!  The current version (4 days
work, so still very raw and incomplete) is snd-run.c in the
Snd tarball:,
but I'm not really trying to push that code -- more something
along the lines that even a partial acceleration like this
is a real improvement, and easy to write.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]