[Remind-Fans] Expression-evaluation speed (was Re: Issues with changing baseyr()? And partial FROM specification?)

Dianne Skoll dianne at skoll.ca
Fri Sep 8 18:55:46 EDT 2023


On Fri, 8 Sep 2023 16:44:04 -0500
Tim Chase via Remind-fans <remind-fans at lists.skoll.ca> wrote:

[snip snip...]

> If you haven't guessed, this is s...l...o...w.  It's not bad on my
> higher-powered daily driver, but on a RPi or my little sliver of
> VPS hosting or older hardware, it's a good several seconds to compile
> and display my agenda.

So, a little insight as to why Remind's expression-evaluation is slow.
I wrote the expression code when I was around 23 years old, before I
knew anything.  I didn't know about lex or yacc; knew nothing formally
about recursive-descent parsers; didn't know about internal tree
representations for expressions.  I just stumbled through it with
basic programming knowledge and fairly good intuition.

Remind's expression evaluator parses and evaluates expressions each
time.  So the expression is stored as a string, and the weird
hand-rolled parser has to process the string each time, with
evaluation happening right during the parsing phase.  This is not
optimal, to say the least.  It also makes it difficult/impossible to
support nice things like short-circuit logical operators.

A while back, I looked at rewriting the expression evaluation engine
in Remind.  The idea was to parse expressions once into an internal
representation, and maybe do some light optimization like common
subexpression elimination.  Then when expressions are evaluated, we'd
use the (presumably much faster) internal representation.

After writing about 500 lines of code, I got bored.  I said "Dammit,
I'm retired from software development!" and wrote a bunch of sketch
comedy and standup instead.

Regards,

Dianne.


More information about the Remind-fans mailing list