On 22 May 2014 19:34, Cosmo Harrigan <notifications@github.com> wrote:
>
> It would also be interesting to figure out if there is some way to avoid
> the overhead of "getting into Scheme" over and over, as you mentioned:
>
> there is some X number of microseconds performance penalty getting into
> scheme, and out again
>
> while still being able to use Scheme.
>
Yes. OK.   Looking at my own notes, I see that compiling can make a huge
difference (see benchmark/diary.txt)

There are two costs: calling C++ from scheme, and calling scheme from C++.
 The first is fast -- about 2-3uS per call (on my rather now-old system).
 The second is very slow ... 150-300uS to enter & exit the interpreter
(python is comparable) (there seem to be a lot of cache-contention effects
making it hard to measure).

Perhaps having a thread holding the scheme evaluator in 'standby' would do
the trick.  Thread-switches in linux seem to be about 5uS .. so this would
be a huge improvement.   Hmm.