Closed masak closed 3 years ago
About a test such as this one:
ok 3 - "TODO (< \\a \\c) ==> t" ==> "TODO (< \\a \\c) ==> t"
When I run this in the REPL, it takes forever.
But when I run the first two of these, they are almost immediate, and the last one only gives a small delay:
Language::Bel 0.56 -- msys.
> (charn \a)
97
> (charn \c)
99
> (< 97 99)
t
More mysteriously, (bin< \a \c)
also takes forever, but (find [all (car _) '(\a \c)] comfns)
is fairly immediate. Not really sure what is going on in bin<
.
Seems I don't have a test file for bin<
, go figure.
This issue is quite strongly related to #339, now that I read both of them.
Not really sure what is going on in
bin<
.
It would seem it ends up calling charn
, but in such a way that it calls the slow Bel-function version, and not the fastfunc. Now the question is why that happens.
I found out why.
comfns
in the globals is we evaluate everything, and then insert it in that list. That's quite close to what a fully bootstrapped Bel-in-Bel would do.charn
gets "inlined" as its slow definition: (lit clo nil (c) ((compose dec pos) c chars caris))
— look, no fastfunc.charn
, because what bin<
expects in to find in comfns
is function values, not symbols that refer to functions.I'm somewhat hopeful that there would still be a way to do the right thing with the evaluation, while also preserving the connection with the fastfunc. Even if there isn't a straightforward way to do that, there might be a hacky hard-coded way to do it.
In
t/comfns.t
andt/example-bel.t
, some evaluations are commented out simply because comparing characters takes forever.Would inserting the appropriate fastfuncs help speed it up, so that we can un-TODO those? I think so.