Programming Leftovers
-
Sean Goedecke ☛ Refactoring to understand and "vibe coding"
The first big problem with vibe coding is that at some point you hit a limit on the size of the codebase, and no further features can be added. If your codebase is modular enough, you can put that off for a while, but eventually you’ll reach a point where sensible code changes require more context than the LLM can contain.
The other big problem is that you didn’t write the code, so you don’t understand it. If you need to answer a question about how the code works, or to build a feature onto it yourself, you have to spend a long time figuring that out. In other words:
Code is not the most valuable artifact. Your understanding of the codebase is.
-
Rlang ☛ The ellmer package for using LLMs with R is a game changer for scientists
Before ellmer you had to know other languages and data-structures, like JSON. Ellmer means that many powerful LLM uses are now easily accessible to R users.
Tool use means the LLM can run commands on your computer to retrieve information. You know how LLMs can be bad at simple math like 2+2 or today’s date? Well, with a tool, the LLM would know to use R to calculate this to return the correct answer. Tools can also connect to web APIs, means they can also be used to retrieve information or databases from the web.
-
Daniel Lemire ☛ Speeding up C++ code with template lambdas
If the divisor d is known at compile-time, this function can be much faster. E.g., if d is 2, the compiler might optimize away the division and use a shift and a few cheap instructions instead. The same is true with all compile-time constant: the compiler can often do better knowing the constant.
-
Karl Seguin ☛ ArenaAllocator.free and Nested Arenas
What happens when you free with an ArenaAllocator? You might be tempted to look at the documentation for std.mem.Alloctor.free which says "Free an array allocated with alloc". But this is the one thing we're sure it won't do.
In its current implementation, calling free usually does nothing: the freed memory isn't made available for subsequent allocations by the arena, and it certainly isn't released back to the operating system. However, under specific conditions free will make the memory re-usable by the arena. The only way to really "free" the memory is to call deinit.
-
Benoit Daloze ☛ Matching Regexps 200 Times Faster
There has been a couple attempts since then to optimize it further using SIMD instructions. This is however quite difficult and messy to do in C as it’s similar to writing inline assembly (N times, with N the number of SIMD variants), and it’s not portable so it needs both compile-time and run-time detection to pick the correct SIMD variant.
In this blog post we compare 3 contenders for the job of converting Ruby Strings to JSON Strings.
-
[Old] Artyom Bologov ☛ Codeberg Pages with SSL and Custom Domain
So I decided to do the most Saturday evening thing programmers do: migrate my website to an absolutely different hosting setup. To Codeberg Pages.
Codeberg doesn't offer some of the features Gitlab provides. In particular, no CI/CD/website builds, and no automatic SSL certificates. Thus this post: to document what I went through to reproduce my current setup on Codeberg: [...]
-
Artyom Bologov ☛ How I Write Generics
Generic functions are beautiful as an idea. But they are also somewhat ugly as a syntax.
My (ab)use of generics led to a certain programming style. This style, I conjecture, ends up in more readable and correct functions. Although it's up to you whether to believe me.
This post will be structured around what generics are. This overview will explain intuition behind my style of writing generics. With examples and reasoning, of course. In the end, I'll share a small macro that nicely abstracts away some of my conventions.
Don't expect some eye-opening experience, it's mostly about formatting and ordering of generic options. Still, helps in setting up style guides.