Login
You're viewing the techdon.dev public feed.
  • Jul 12, 2026, 7:45 PM

    i finally actually figured out how unions in C work, and now the struct i'm dynamically allocating aligns to 12 bytes instead of 16, which not only means that i can easily fit a markov model of a ~60kb text in ~256kb of RAM, but i can also overallocate enough buckets in the model's hash table that lookups actually approximate O(1) instead of being a glorified linear lookup

    💬 1🔄 0⭐ 0

Replies

  • Jul 12, 2026, 8:02 PM

    (this is after having bought myself an extra 6kb of RAM by telling the linker to steal some space for the heap from the stack. messing with the linker like that is also something i hadn't done before! learning so many things on this project)

    💬 0🔄 0⭐ 0
  • Jul 12, 2026, 8:05 PM

    @aparrish you should be able to get rid of the hash table entirely; the state transition (a, b, ..., k) -> m necessarily leaves you in state (b, ..., k, m) and that means you can precompute the state you'll land on after traversing each edge

    and then each state has an array of out-edges and each out-edge is a pair (word, next-state) and that's all you need

    💬 2🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • Jul 12, 2026, 8:10 PM

    @zwol yeah i know. i don't want to precompute with this project though, partially for Art Reasons, and partially because i want to be able to poke at/intercept/modify parts of the model building and generation process at run time

    💬 1🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0