Tuesday | 21 MAY 2024
[ previous ]
[ next ]

Speeding up the Template Rendering

Date: 2023-07-02

I finished the rewrite of my RENDER function and it has saved about 50% of the time on the fizzbuzz. Unfortunately my blog rendering didn't see those gains because the bulk of the time is spent in the reading of files.


The biggest gains I saw were the simplification of logic and more abuse of how multivalue works. I do more parsing in bulk rather than going character by character and that was a big lesson. I think trying to do as much matching and retrieving of tokens without going letter by letter was better.

It also simplified certain things such that adding new statements now will be much simpler than before.

Unifying the logic for multiline statements and single line statements was something I should have done earlier. I like my strategy of focusing on the multiline statement and then simply changing the single statement in place to be multiline. This simplifies everything. In my original design I had 2 different chunks of code running depending on if it was multiline or single line. This mean updating two areas when I added a statement.

The gain in speed was worth it and the rewrite flowed much better. However this is still a poor function. It still takes a hot second and there are still issues with the way I do parsing and expressions.

Slowly slowly. I wish I could be at the skill level where things like this are simple.