:: krowemoh

Thursday | 26 DEC 2024
Posts Links Other About Now

previous
next

Rewriting the Template Render

2023-06-29
basic, template-language

I'm currently rewriting the template language and I've cut down fizzbuzz by 50%. This is a big for loop with a few conditionals, nothing super complex. I'm hoping that it will generalize to more complex things. I sped things up by 50% by using the native FIELD and CHANGE commands to quickly figure out expressions. Instead of building up a string and parsing on the fly, I try to bulk change things to attribute and value marks and then using the field to seperate things out.

I believe this has helped quite a bit but it may come back to bite me.

I removed alot of the LOOPs I had for FOR statements with the UNTIL. This seems to be faster though unproven. A very quick test told me that it was faster to use a for loop which was quite interesting.

Now I need to implement the rest of the language and then test it against my blog. If I get a 50% decrease in blog creation then I'm going to be quite happy.

I rewrote my IF logic now. It uses what I did before but it combines my single line IF with my multiline IF. I rewrite the single line into a multiline IF which allows my to re-use my logic. This step was crucial so I can implement both single and block style statements like READ and OPEN. The INSERTs and DELETEs I'm doing now however are going to be expensive and this is going incentivize writing out the full block codes. There might be a better way to do this in a preprocessor step.

Adding this preprocess step might be easy and it wouldn't require me to remove my single line handling logic.

If this succeeds, then I will turn my attention to my EVALUATE function. That is the inner core of my language and speeding that up would be huge.