Todd Sundsted
Todd Sundsted
toddsundsted@epiktistes.com
Better dead than bored.
Introductionepiktistes.com/introduction
GitHubgithub.com/toddsundsted/ktistec
Pronounshe/him
🌎Sector 001
Todd Sundsted

looking back through the recent history (less than a year) of posts i've received on my ktistec instance, and doing a few spot checks, i'd say that less than 50% of those posts still exist.

Todd Sundsted

i got memberships and lined up a room for worldcon glascow, the 82nd world science fiction convention!

#worldcon #glascow

Todd Sundsted

my current canary for build resource utilization is a low end cloud server.  when builds start to fail it's time to optimize.

more on the last round of build optimizations for ktistec, shortly.

#ktistec #optimization

Todd Sundsted

The Cost of Small Methods

Ktistec uses a template engine for it's views.

View templates are transformed into Crystal code that generates HTML when executed. As you'd expect, the template language allows you to use string interpolation syntax (e.g. #{expression}) for dynamic values.

To ensure expression is only evaluated once, and to limit the scope of the temporary variable holding the evaluated value of expression, I originally bound the value to the variable using Object#tap (commit 5e1bf19e). The generated code looked something like:

(expression).tap do |__value__|
   <template code that uses expression>
end

Blocks in Crystal are always inlined, so the code above should be equivalent to the following (sacrificing local scope):

__value__ = (expression)
<template code that uses expression>

Functionally, they are equivalent. But operationally, not so much! With Object#tap, the Ktistec executable is about 1% larger (36823603 bytes vs. 36526307 bytes) and build times take 20% longer (23 seconds vs. 19 seconds, generally).

In total, view templates represent about 6% of the Ktistec executable by size, so it doesn't surprise me that there's a measurable impact when I make changes to the template engine, but wow...! I can almost live with the size of the executable, but the build time...!

The cost has to be the method call.

What I'm looking for is something like let in Scheme. The following macro comes close, but doesn't limit scope quite the same way:

macro let(expr, &block)
  {{block.args.first}} = ({{expr}})
  {{block.body}}
end

I maybe have to live with the macro—I tried to implement let as a method with the annotation @[AlwaysInline] but there was no improvement over the original.

The template engine is a fork of Slang—which I've been evolving to be more Slim-compatible.

#ktistec #crystallang

Todd Sundsted
Todd SundstedBeta Ziliani :crystal: 🏳️‍🌈

HertzDevil is in need of a new job. You probably know who he is: Core Team member since mid 2022, and main developer behind the recent advances in Windows support. And that’s not only it, he has done lots of work in very distant parts of the compiler and ecosystem. You’ll have fun reading through the almost 700 PRs¹ that he got in.

As his team lead this past year, I’m sorry to let go such an amazing person. Funding reasons forced us to. I have a privileged spot to see him working, an experience I can share with anyone interested. Quite frankly, he’s the Messi of Software Engineering, but with a humble heart!

#fedihired #crystallang #jobsearch

¹ github.com/crystal-lang/crysta

Todd Sundsted

getting into the spirit of mardi gras early by getting my funky meters albums out!

Todd Sundsted

i installed ollama. 20 minutes later i had llama2 running locally. almost all of that time was downloading the pre-trained model. performance and quality are better than i expected! (technical reference point: i'm on a macbook m3 max with 48gb of memory but that does not seem to be in any way required—i'm going to try some older hardware later.)

i'm still trying to sort out which llms are really open source (architecture, source code, training data, weights) and which are not.

#ollama #llama2

Todd Sundsted

i feel like watching those new zealand tourism videos i mean the lord of the rings...

Todd Sundsted

two architectural decision records down. writing is hard work!