Show all entries

Fri 2023-04-07

Recursion is my friend.

I went back to the recursive version of "drop" in value.c. The test/check now runs about 2% faster.

Formerly I was aiming to eliminate all recursive C routines in Fexl, in line with my goal to produce a "JPL-compliant" version of Fexl. I am now shelving that goal, at least for now.

Eliminating recursion requires simulating the system stack, but that makes the code more complex and slower. There is no way doing my own stack can compete with the built-in system stack.

The non-recursive drop routine was acceptably fast and not terribly complex, but things got worse when I tried removing recursion from the "subst" routine in type_sym.c. I got it to work by translating substitution patterns into linear vectors of opcodes, but it was much more complex and much slower.

That was bad enough, but imagine removing recursion from "eval" and the parser. No thank you. Recursion is my friend.