feed.xml (48134B)
1 <?xml version="1.0" encoding="UTF-8"?> 2 <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 3 <channel> 4 <title>Andrew's Blog</title> 5 <link>https://blog.laack.co</link> 6 <description>Latest posts from Andrew's blog</description> 7 <language>en-us</language> 8 <managingEditor>andrew@laack.co</managingEditor> 9 <webMaster>andrew@laack.co</webMaster> 10 <lastBuildDate>Sun, 20 Sep 2026 21:56:48 -0500</lastBuildDate> 11 <atom:link href="https://blog.laack.co/feed.xml" rel="self" type="application/rss+xml"/> 12 <item> 13 <title><![CDATA[PyGame vs. Raylib]]></title> 14 <link>https://blog.laack.co/pygame-vs-raylib.html</link> 15 <description><![CDATA[<p>I implemented <a href="https://cp-algorithms.com/graph/mst_prim.html">Prim’s algorithm</a> to create a MST of a graph in Python. I also created a visualization of it, shown below.</p> 16 <p><video src="videos/prim.mkv" controls=""><a href="videos/prim.mkv">Video</a></video></p> 17 <p>(This graph has 250 vertices and 1,000 edges. The source code used to generate this visualization can be found <a href="https://git.laack.co/blog/file/python/pygame-vs-raylib/prim.py.html">here</a>)</p> 18 <p>Prim’s algorithm is worth understanding (albeit out of scope), and the problem it solves is finding the set of edges that minimizes the sum of their weights while guaranteeing there is exactly one path between any two vertices in the connected, weighted, undirected graph. In the case of my implementation, the weight of each edge was its length.</p> 19 <p>As it relates to the animation, the following two things should be apparent:</p> 20 <ol type="1"> 21 <li>The first frame must draw every edge and vertex of the graph in a greyed-out color.</li> 22 <li>Each subsequent frame only has to draw one additional edge, the newly traversed edge, and one additional vertex, the vertex we are visiting.</li> 23 </ol> 24 <p>While we could render each frame from scratch based on the graph’s state, any reasonable rendering program has the ability to additively draw geometries to avoid this re-computation, and I care a bit about performance (even though this is written in Python*). Since PyGame and Raylib both support this, I’ll be using additive rendering in both of my implementations.</p> 25 <p>* I did rewrite the animation in C++ using Raylib so I could make it <a href="https://git.laack.co/abg/">my X11 wallpaper</a>, but that’s for another blog post.</p> 26 <h2 id="raylib">Raylib</h2> 27 <h3 id="implementation">Implementation</h3> 28 <p>Raylib has 2D rendered textures that can persist across frames. Here’s some Python code that makes use of them to visualize Prim’s algorithm:</p> 29 <pre class="python"><code>import pyray as pr 30 31 # ... (other imports, Vertex class definition, Edge class definition) 32 33 pr.init_window(screen_width, screen_height, "prim") 34 35 # ... (other initialization) 36 37 texture = pr.load_render_texture(screen_width,screen_height) 38 39 while !done: 40 if first: 41 start = time.monotonic_ns() 42 43 # After calling begin_texture_mode(texture) all writes will be 44 # sent to the texture without having to specify we're writing to the 45 # texture. This is also how begin_drawing() works, but for frames. 46 47 pr.begin_texture_mode(texture) 48 pr.clear_background(pr.BLACK) 49 50 for edge in edge_list: 51 edge.draw_edge(pr.DARKGRAY) 52 for vertex in graph: 53 vertex.draw_vertex(pr.DARKGRAY) 54 55 pr.end_texture_mode() 56 57 source_rec = pr.Rectangle(0, 0, screen_width, screen_height) 58 dest_rec = pr.Rectangle(0, 0, screen_width, screen_height) 59 60 pr.begin_drawing() 61 pr.draw_texture_pro(texture.texture, source_rec, dest_rec, pr.Vector2(0, 0), 0, pr.WHITE) 62 pr.end_drawing() 63 64 first = False 65 66 end = time.monotonic_ns() 67 first_times.append(end - start) 68 69 continue 70 71 # ... (perform one step of Prim's algorithm) 72 73 if len(to_draw_edge) != 0 or len(to_draw_vert) != 0: 74 start = time.monotonic_ns() 75 76 pr.begin_texture_mode(texture) 77 78 for edge in to_draw_edge: 79 edge.draw_edge(pr.WHITE) 80 for vert in to_draw_vert: 81 vert.draw_vertex(pr.WHITE) 82 83 pr.end_texture_mode() 84 85 source_rec = pr.Rectangle(0, 0, screen_width, screen_height) 86 dest_rec = pr.Rectangle(0, 0, screen_width, screen_height) 87 88 pr.begin_drawing() 89 pr.draw_texture_pro(texture.texture, source_rec, dest_rec, pr.Vector2(0, 0), 0, pr.WHITE) 90 pr.end_drawing() 91 92 end = time.monotonic_ns() 93 redraw_times.append(end - start) 94 95 to_draw_vert = [] 96 to_draw_edge = []</code></pre> 97 <p>Before our main iteration loop we initialize our texture. Then on our first iteration of the loop we draw each of the edges and vertices in our graph. On each subsequent iteration we only draw vertices added to <code>to_draw_vert</code> and edges added to <code>to_draw_edge</code>. Both lists are populated with edges and vertices that were visited since the last frame was rendered.</p> 98 <p>This code is also instrumented to track the amount of time the first frame takes to render, and the amount of time each subsequent frame takes to render as well.</p> 99 <p>Not included above are our Vertex and Edge classes which both implement draw functions. These functions have the following lines to draw geometries with Raylib:</p> 100 <pre class="python"><code>pr.draw_circle(int(self.x),int(self.y), RADIUS, c) # vertex 101 pr.draw_line(int(self.v1.x), int(self.v1.y), int(self.v2.x), int(self.v2.y), c) # edge</code></pre> 102 <p>Per the code comment in the larger code snippet, Raylib uses global state to track which canvas is being drawn to, so these functions can be called in texture mode or drawing mode with a similar effect.</p> 103 <h2 id="pygame">PyGame</h2> 104 <h3 id="implementation-1">Implementation</h3> 105 <p>PyGame persists frame state across frames by default so we don’t have to mess with rendered textures like we did with Raylib! Here’s a some code that does the PyGame rendering:</p> 106 <pre class="python"><code> 107 # ... (imports and such) 108 109 pygame.init() 110 display = pygame.display.set_mode((screen_width,screen_height)) 111 112 # ... (other initialization) 113 114 while !done: 115 if first: 116 start = time.monotonic_ns() 117 118 display.fill(BLACK) 119 120 for edge in edge_list: 121 edge.draw_edge(display, LIGHT_GREY) 122 for vertex in graph: 123 vertex.draw_vertex(display, LIGHT_GREY) 124 125 pygame.display.update() 126 127 end = time.monotonic_ns() 128 first_time.append(end - start) 129 130 first = False 131 continue 132 133 # ... (perform one step of Prim's algorithm) 134 135 start = time.monotonic_ns() 136 137 for edge in to_draw_edge: 138 edge.draw_edge(display, white) 139 for vert in to_draw_vert: 140 vert.draw_vertex(display, white) 141 142 pygame.display.update() 143 end = time.monotonic_ns() 144 145 to_draw_vert = [] 146 to_draw_edge = []</code></pre> 147 <p>I find this code to be more readable than the Raylib code because we don’t have to maintain a standalone texture, and I also like how writing to a display is more explicit in PyGame:</p> 148 <pre class="python"><code>pygame.draw.circle(display, WHITE, (self.x,self.y), RADIUS) 149 pygame.draw.line(display, WHITE, (self.v1.x,self.v1.y), (self.v2.x,self.v2.y), LINE_WIDTH)</code></pre> 150 <p>(notice the first parameter is the surface to write to)</p> 151 <p>Despite this, the final <code>pygame.display.update()</code> is still using global state, which feels a bit strange given we have to specify which surface we are drawing to.</p> 152 <h2 id="benchmarking">Benchmarking</h2> 153 <p>The benchmarks were executed under the following conditions:</p> 154 <ul> 155 <li>Vertex count: 2,500</li> 156 <li>Edge count: 25,000</li> 157 <li>Screen dimensions: 5120x1440</li> 158 <li>CPU: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz (4 cores, 8 threads)</li> 159 <li>iGPU: Intel Corporation TigerLake-LP GT2 [Iris Xe Graphics]</li> 160 <li>OS: Arch Linux</li> 161 </ul> 162 <p>Additionally, the metrics are all <strong>averages</strong> across 10 full runs.</p> 163 <table> 164 <thead> 165 <tr> 166 <th>Library</th> 167 <th>First frame time (ms)</th> 168 <th>Incremental frame time (ms)</th> 169 </tr> 170 </thead> 171 <tbody> 172 <tr> 173 <td>Raylib</td> 174 <td>29.87 ± 0.74</td> 175 <td>2.88 ± 1.11</td> 176 </tr> 177 <tr> 178 <td>PyGame</td> 179 <td>323.39 ± 44.60</td> 180 <td>5.59 ± 0.65</td> 181 </tr> 182 </tbody> 183 </table> 184 <p>In this benchmark Raylib’s average incremental frame render time was ~2x faster than PyGame’s, and its first frame render time was ~11x faster.</p> 185 <h3 id="why-is-pygame-so-slow">Why Is PyGame So Slow?</h3> 186 <p>Let’s instrument our code to dig deeper:</p> 187 <pre class="python"><code>if first: 188 start = time.monotonic_ns() 189 display.fill(BLACK) 190 191 edge_times = [] # new 192 vertex_times = [] # new 193 194 for edge in edge_list: 195 se = time.monotonic_ns() # new 196 edge.draw_edge(display, LIGHT_GREY) 197 ee = time.monotonic_ns() # new 198 edge_times.append(ee - se) # new 199 200 for vertex in graph: 201 sv = time.monotonic_ns() # new 202 vertex.draw_vertex(display, LIGHT_GREY) 203 ev = time.monotonic_ns() # new 204 vertex_times.append(ev - sv) # new 205 206 pygame.display.update() 207 end = time.monotonic_ns() 208 first_time.append(end - start) 209 210 first = False 211 212 print("Edge time avg: " + str(sum(edge_times) / len(edge_times))) # new 213 print("Vertex time avg: " + str(sum(vertex_times) / len(vertex_times))) # new 214 215 continue</code></pre> 216 <p>(Notice the addition of timing for individual edge and vertex draw times for the first frame)</p> 217 <p>Let’s also update our Raylib code to do the same:</p> 218 <pre class="python"><code>if first: 219 start = time.monotonic_ns() 220 pr.begin_texture_mode(texture) 221 pr.clear_background(pr.BLACK) 222 223 edge_times = [] # new 224 vertex_times = [] # new 225 226 for edge in edge_list: 227 es = time.monotonic_ns() # new 228 edge.draw_edge(pr.DARKGRAY) 229 ee = time.monotonic_ns() # new 230 edge_times.append(ee - es) # new 231 for vertex in graph: 232 vs = time.monotonic_ns() # new 233 vertex.draw_vertex(pr.DARKGRAY) 234 ve = time.monotonic_ns() # new 235 vertex_times.append(ve - vs) # new 236 237 pr.end_texture_mode() 238 239 source_rec = pr.Rectangle(0, 0, screen_width, screen_height) 240 dest_rec = pr.Rectangle(0, 0, screen_width, screen_height) 241 242 pr.begin_drawing() 243 pr.draw_texture_pro(texture.texture, source_rec, dest_rec, pr.Vector2(0, 0), 0, pr.WHITE) 244 pr.end_drawing() 245 246 end = time.monotonic_ns() 247 first_time.append(end - start) 248 249 first = False 250 251 print("Edge time avg: " + str(sum(edge_times) / len(edge_times))) # new 252 print("Vertex time avg: " + str(sum(vertex_times) / len(vertex_times))) # new 253 254 continue</code></pre> 255 <p>Running this updated code once we find:</p> 256 <table> 257 <thead> 258 <tr> 259 <th>Library</th> 260 <th>Avg. Edge Draw Time (ns)</th> 261 <th>Avg. Vertex Draw Time (ns)</th> 262 </tr> 263 </thead> 264 <tbody> 265 <tr> 266 <td>PyGame</td> 267 <td>9504.15048</td> 268 <td>686.6508</td> 269 </tr> 270 <tr> 271 <td>Raylib</td> 272 <td>944.15884</td> 273 <td>3016.1852</td> 274 </tr> 275 </tbody> 276 </table> 277 <p>PyGame is faster at drawing vertices (circles), but slower at drawing edges (lines). Since we are drawing many more edges than we are vertices, this contributes to making PyGame slower.</p> 278 <p>PyGame is slower at drawing lines because it uses SDL which computes lines pixel by pixel on the CPU*, while Raylib appends the line ends to a queue for batch processing, to be asynchronously processed by the GPU.</p> 279 <p>In the case of vertices, Raylib calls <code>DrawCircleSector()</code>, and this in turn appends geometries to the GPU drawing queue, but each circle is made of many discrete geometries which are each appended to the queue, costing cycles. Contrasting this with the PyGame approach where PyGame only has to draw a few pixels onto the surface.</p> 280 <p>* There are ways to change the rendering pipeline for PyGame to make better use of GPUs, but these approaches are either complex or experimental.</p> 281 <h4 id="is-that-why-pygame-is-slower">Is that why PyGame is slower?</h4> 282 <p>That’s not the fully story. Let’s consider what the numbers above mean. The first frame renders 2,500 vertices, 25,000 edges. Each subsequent frame renders 1 vertex and 1 edge. If we multiply these numbers with the values we calculated for the amount of time each draw takes, we get the following expected frame times:</p> 283 <table> 284 <colgroup> 285 <col style="width: 33%" /> 286 <col style="width: 33%" /> 287 <col style="width: 33%" /> 288 </colgroup> 289 <thead> 290 <tr> 291 <th>Library</th> 292 <th>Expected First Frame Draw Time (ms)</th> 293 <th>Expected Subsequent Frame Draw Time (ms)</th> 294 </tr> 295 </thead> 296 <tbody> 297 <tr> 298 <td>PyGame</td> 299 <td>239.3204</td> 300 <td>0.0101908</td> 301 </tr> 302 <tr> 303 <td>Raylib</td> 304 <td>31.14443</td> 305 <td>0.003960344</td> 306 </tr> 307 </tbody> 308 </table> 309 <p>Based on this, we see the first frame times are on par with what we actually saw in our benchmarking, but the subsequent frame draw times are orders of magnitude faster than what we benchmarked, and since most frames are subsequent frames, they are severely impacting performance. Let’s see if we can figure out why this disparity exists.</p> 310 <h5 id="pygame-flamegraph">PyGame Flamegraph</h5> 311 <p><img src="images/pygame-flamegraph.svg" /></p> 312 <h5 id="raylib-flamegraph">Raylib Flamegraph</h5> 313 <p><img src="images/rlib-flamegraph.svg" /></p> 314 <p>We see most of our time is being spent in <code>EndDrawing()</code> for Raylib and <code>pygame.display.update()</code> for Pygame. After instrumenting these calls we find the following times per invocation:</p> 315 <table> 316 <thead> 317 <tr> 318 <th>Library</th> 319 <th>Function</th> 320 <th>Average Call Time (ms)</th> 321 </tr> 322 </thead> 323 <tbody> 324 <tr> 325 <td>PyGame</td> 326 <td><code>EndDrawing()</code></td> 327 <td>5.677199</td> 328 </tr> 329 <tr> 330 <td>Raylib</td> 331 <td><code>pygame.display.update()</code></td> 332 <td>2.680623</td> 333 </tr> 334 </tbody> 335 </table> 336 <p>Based on our original frame time benchmarks, these calls make up almost all of the time spent rendering subsequent frames.</p> 337 <h4 id="what-are-these-functions-doing">What Are These Functions Doing?</h4> 338 <p>In the case of Raylib, EndDrawing does a few things:</p> 339 <ol type="1"> 340 <li>Calls <code>rlDrawRenderBatchActive()</code> 341 <ul> 342 <li>This clears the batched geometries queue, issuing the OpenGL calls</li> 343 </ul></li> 344 <li>Calls <code>SwapScreenBuffer()</code> 345 <ul> 346 <li>This swaps the buffer the display scans out. In effect, this ensures the frame we just drew becomes visible.</li> 347 <li>This is done by with <code>glfwSwapBuffers()</code>, but this is beyond scope as it requires an understanding of OpenGL and double buffering.</li> 348 <li>In the normal case (which is how our code uses it), this function returns after the instructions have been issued, not once the frame has been rendered.</li> 349 </ul></li> 350 <li>Optionally waits to hit the target framerate in cases where rendering is happening faster than the target</li> 351 </ol> 352 <p>Most of the time spent here is on the second step. This is because issuing the instructions to swap will flush the driver’s command stream, and once a few frames are in flight, this will block until the GPU retires one.</p> 353 <p>Let’s step through the PyGame <code>update()</code> function too:</p> 354 <ol type="1"> 355 <li>Calls <code>pg_update()</code> in <code>src_c/display.c</code> 356 <ul> 357 <li>This performs some basic checks to make sure a display is set</li> 358 </ul></li> 359 <li><code>pg_update()</code> calls <code>SDL_UpdateWindowSurfaceRects</code> 360 <ul> 361 <li>This copies the buffer into a buffer owned by the windowing system (X11 in my case)</li> 362 </ul></li> 363 </ol> 364 <p>The main reason this is slower is PyGame copies the whole frame on the CPU for each frame while Raylib’s frame is already in VRAM and the swap doesn’t <a href="https://en.wikipedia.org/wiki/Bit_blit">blit</a>.</p> 365 <h2 id="takeaways">Takeaways</h2> 366 <p>Out of the box Raylib has better performance because it performs hardware accelerated rendering. In terms of ergonomics, they both have their own quirks. Raylib feels like a C library with Python bindings (because it is!), while PyGame feels inconsistent, mixing both explicit surface drawing, and global state for frame updates.</p> 367 <p>Personally, I’m not keen on using PyGame again because I enjoy writing performant software, and the reality of Python is it can’t be performant. This doesn’t mean I won’t ever write Python code again, it’s useful for first passes at a problem, but if I want to productionize that software I’ll have to rewrite it in a sensible programming language. The nice thing about doing a first pass on a project in Raylib is you can then rewrite it in C using Raylib directly, but the same isn’t true for PyGame.</p>]]></description> 368 <pubDate>Sun, 20 Sep 2026 00:00:00 -0500</pubDate> 369 <guid>https://blog.laack.co/pygame-vs-raylib.html</guid> 370 </item> 371 <item> 372 <title><![CDATA[Easily Hostable Protocols Over Applications]]></title> 373 <link>https://blog.laack.co/easily-hostable-protocols-over-applications.html</link> 374 <description><![CDATA[<p>Motivated by Joshua Blais’ blog post about using the internet like it’s 1999 [1] I wanted to discuss an application and a protocol with characteristics that make them bad from a user freedom perspective. I also want to discuss solutions.</p> 375 <h2 id="zulip">Zulip</h2> 376 <p>Zulip [2] is an instant messaging program that looks like a bastion of freedom. I thought it was because it is free software which ought to be the epitome of user freedom, but it is not that simple. Free software is necessary but not sufficient for appropriate user freedom.</p> 377 <p>Try to find a third party Zulip client for GNU/Linux. You will not. This frequently happens when you use applications and not protocols. Let’s consider three alternative protocols that facilitate instant messaging:</p> 378 <ol type="1"> 379 <li>IRC</li> 380 <li>XMPP</li> 381 <li>Matrix</li> 382 </ol> 383 <p>Look for third party clients for any of these and they will abound. These protocols were sensibly designed to give users the freedom to decide how they interact with their data and the data others show them.</p> 384 <p>Nothing is stopping you from creating a third-party client for Zulip. The problem is applications aren’t designed with this in mind, but protocols are. The main reason applications generally have so few clients is they frequently change their interfaces in breaking ways. Quality protocols are designed from the ground up to ensure consistent interfaces, often with backwards compatibility in mind.</p> 385 <h2 id="at-protocol">AT Protocol</h2> 386 <p>The AT Protocol [3] is used by the social network Bluesky. This is a common way people introduce the protocol, and it should give you pause that a protocol is frequently associated with a singular company and social network.</p> 387 <p>Choices in the design of the AT Protocol have led to it being too costly for individuals to run full-fledged servers (see [4] for details). This results in most AT Protocol users being entirely dependent on the Bluesky organization [5] (this link is worth following). Having a strong reliance on a VC backed social media company [6] is a good way to become the product when investors demand returns. This also limits freedom by having a centralized authority with the ability to censor speech [7].</p> 388 <p>An alternative to the AT Protocol is ActivityPub. Mastodon [8] uses ActivityPub to facilitate microblogging, and the software can be hosted on cheap hardware without a reliance on a third-party. Proponents of the AT Protocol may claim the two perform different functions, and I agree, but the centralized feed functionality the AT Protocol can provide but ActivityPub can’t is something I consider to be deeply problematic from a human psychology perspective. As such, while ActivityPub can’t directly replace “your” BlueSky feed, it will give you a healthier microblogging experience. With that said, I think the case for microblogging is lacking, and individuals should consider if microblogs, both their own and those of others, are worthwhile (my answer is emphatically no).</p> 389 <h2 id="proposition">Proposition</h2> 390 <p>Host your own services for the dissemination of information, ensuring the services you host implement protocols designed for the type of information you are disseminating.</p> 391 <p>I use Git (not GitHub) for software distribution, RSS, Gemini [9], and HTTP for broadcasted textual information, email for bidirectional individual or small group communication, and XMPP or IRC for larger group communication. These are the protocols built for these use cases, and they should be used as such.</p> 392 <h2 id="citations">Citations</h2> 393 <p>[1] - <a href="https://joshblais.com/blog/using-the-internet-like-its-1999/">https://joshblais.com/blog/using-the-internet-like-its-1999/</a></p> 394 <p>[2] - <a href="https://zulip.com">https://zulip.com</a></p> 395 <p>[3] - <a href="https://en.wikipedia.org/wiki/AT_Protocol">https://en.wikipedia.org/wiki/AT_Protocol</a></p> 396 <p>[4] - <a href="https://dustycloud.org/blog/how-decentralized-is-bluesky/">https://dustycloud.org/blog/how-decentralized-is-bluesky/</a></p> 397 <p>[5] - <a href="https://arewedecentralizedyet.online/">https://arewedecentralizedyet.online/</a></p> 398 <p>[6] - <a href="https://bsky.social/about/blog/03-19-2026-series-b">https://bsky.social/about/blog/03-19-2026-series-b</a></p> 399 <p>[7] - <a href="https://bsky.social/about/support/community-guidelines">https://bsky.social/about/support/community-guidelines</a></p> 400 <p>[8] - <a href="https://joinmastodon.org/">https://joinmastodon.org/</a></p> 401 <p>[9] - <a href="http://geminiprotocol.net/">http://geminiprotocol.net/</a></p>]]></description> 402 <pubDate>Sat, 25 Apr 2026 00:00:00 -0500</pubDate> 403 <guid>https://blog.laack.co/easily-hostable-protocols-over-applications.html</guid> 404 </item> 405 <item> 406 <title><![CDATA[Config Files Suck]]></title> 407 <link>https://blog.laack.co/config-files-suck.html</link> 408 <description><![CDATA[<p>Config files suck for three main reasons.</p> 409 <h2 id="reasons">Reasons</h2> 410 <ol type="1"> 411 <li>They often require learning an idiosyncratic way of defining things that doesn’t generalize across programs</li> 412 <li>They are annoying to version and track</li> 413 <li>They limit the configurability of software</li> 414 </ol> 415 <h2 id="explanation">Explanation</h2> 416 <h3 id="learning-useless-things-sucks">Learning Useless Things Sucks</h3> 417 <p>Config files suck because learning useless things sucks. Most config files follow their own definition format. This results in ephemeral information being learned and very quickly forgotten. Often this process repeats a few times for pieces of software that require reconfiguration to meet the expectations of the user.</p> 418 <p>The time spent understanding the DSL of the config file would likely be better spent writing code in a proper programming language. There are two primary benefits to this. First, it builds on prior experience. If you are skilled at writing C code your ability to understand and configure software that is configured in C is improved by this prior knowledge. Second, by doing this process of configuration you are learning information that is likely less ephemeral. There are only a few good programming languages and by programming in them your proficiency in using them increases.</p> 419 <h3 id="the-disconnect-between-configuration-and-source-code-sucks">The Disconnect Between Configuration and Source Code Sucks</h3> 420 <p>Consider my dotfiles [1]. There are three files in my dotfiles that don’t reside in the XDG_CONFIG_HOME directory. These three files are my .bashrc, my .Xresources, and my .xinitrc files. I have these in my XDG_CONFIG_HOME directory and symlink to them from their expected locations because the programs don’t respect the XDG_CONFIG_HOME directory specification. This is annoying to setup on each system I use. A simple solution to this is to not use software that doesn’t respect the spec, but when Xorg and Bash don’t respect the spec, it becomes a bit more difficult to do so.</p> 421 <p>The bigger issue is that the disconnect between the configuration of software and source code results in multiple sources of information contributing to the configuration of a software program. This is annoying because to achieve the same program configuration across systems one must ensure two different locations are synchronized instead of one.</p> 422 <h3 id="being-limited-in-what-you-can-change-about-programs-sucks">Being Limited in What You Can Change About Programs Sucks</h3> 423 <p>Config files often don’t allow for large changes to be made to programs. The changes that can be made are constrained to what is deemed reasonable by the developers of the software. This is not similar to proprietary software where the developers actively hinder the freedom of users, but by having the source code and the configuration done in the same location, you can fundamentally change the operation of the program without jumping between different locations.</p> 424 <h2 id="the-redeeming-factor">The Redeeming Factor</h2> 425 <p>As I see it, config files are worthwhile if users are expected not to build from source. This may be the case for many open source projects, but I personally dislike using software in this way. This is a matter of opinion, but I think one of the most valuable parts free software is the freedom to change the source code as I see fit. By distributing software with config files, this sends an implicit message to users that they are expected to use the software as is, without modifying the source code.</p> 426 <p>If you don’t see a reason to build from source, it is your right to continue using config files. If you are building a project where you want users to configure, extend, and customize their computing experience to the fullest extent, consider doing away with config files as it forces users to directly manipulate your codebase, giving them more autonomy and flexibility. This may hinder mass adoption, but is that why you build software? It’s not why I do.</p> 427 <h2 id="citations">Citations</h2> 428 <p>[1] - <a href="https://git.laack.co/dotfiles">https://git.laack.co/dotfiles</a></p>]]></description> 429 <pubDate>Wed, 19 Nov 2025 00:00:00 -0600</pubDate> 430 <guid>https://blog.laack.co/config-files-suck.html</guid> 431 </item> 432 <item> 433 <title><![CDATA[You Don't Need Anything]]></title> 434 <link>https://blog.laack.co/you-dont-need-anything.html</link> 435 <description><![CDATA[<h2 id="context">Context</h2> 436 <p>The words we say have an impact on how we think. A word I find problematic is the word need.</p> 437 <h2 id="definition">Definition</h2> 438 <p>Need: a requirement, necessary duty, or obligation [1].</p> 439 <h2 id="my-thoughts">My Thoughts</h2> 440 <p><strong>Do You Really <em>need</em> Anything?</strong></p> 441 <p>I often say this when people use an unqualified need. An unqualified need is as follows:</p> 442 <p><strong>I <em>need</em> to eat food, I’m starving!</strong></p> 443 <p>Aside from the fact that they likely aren’t starving, they don’t <em>need</em> food. This can be thought of in a similar way as the is-ought problem [2]. If someone says they <em>need</em> something, you can ask them, “Why do you <em>need</em> it?”. In the case of food they may say, “I <em>need</em> food to survive”, and to this you may say, “Why do you <em>need</em> to survive”, and this can continue indefinitely as needs are predicated upon something. Often need has an implicit qualification as is the case of, “I <em>need</em> food” implying that it is needed to survive, but you don’t <em>need</em> to survive. I don’t want you to die, but it is not necessary for you to live. Tying this to the definition of need, there is no requirement, duty, or obligation for someone to be alive. There are no universal requirements to do things, no one has a universal duty to do things, and no one has a universal obligation to do anything. You may <em>need</em> to complete a project at work to not get fired, but you don’t <em>need</em> to complete the project, you can just get fired, you are not obligated to not be fired.</p> 444 <p>The danger in statements like, “I <em>need</em> to eat food”, is they create a dependence upon something. By saying you <em>need</em> something you are telling yourself that without it you are incomplete. You are beholden unto this thing. This is dangerous because it leads to acts of immorality because of the perception that something must be done. I believe this is what has led to mass surveillance. People think they <em>need</em> to do what their boss tells them to do even when they know it’s wrong.</p> 445 <p>YOU DON’T NEED ANYTHING. You want it because you perceive the consequences of not having it are worse than having it. This is not a need. This is a want. Understand the difference.</p> 446 <p>You don’t need to live. You don’t need food. You don’t need water.</p> 447 <h2 id="citations">Citations</h2> 448 <p>[1] - <a href="https://www.dictionary.com/browse/need">https://www.dictionary.com/browse/need</a></p> 449 <p>[2] - <a href="https://en.wikipedia.org/wiki/Is%E2%80%93ought_problem">https://en.wikipedia.org/wiki/Is%E2%80%93ought_problem</a></p>]]></description> 450 <pubDate>Fri, 17 Oct 2025 00:00:00 -0500</pubDate> 451 <guid>https://blog.laack.co/you-dont-need-anything.html</guid> 452 </item> 453 <item> 454 <title><![CDATA[Stop Collecting User Data]]></title> 455 <link>https://blog.laack.co/stop-collecting-user-data.html</link> 456 <description><![CDATA[<h2 id="problem-statement">Problem Statement</h2> 457 <p>Sending the data of people who use applications you built, by default, for any purpose that is not strictly required for the application to function is morally wrong.</p> 458 <h2 id="why-does-this-matter">Why Does This Matter</h2> 459 <p>This matters because humans are trusting. It abuses this trust by tracking unnecessary data about application usage because most humans implicitly assume this is not being done, and they often don’t understand what the consequences of this tracking can be [1][2]. Additionally, it is unreasonable to expect users to look through your source code, all of your settings, and your docs to understand what data is being collected. If data is being collected, it should be obvious based on the purpose of the application, and if it is not obvious that it must be collected for the application to work, this should be made explicitly clear to users in the most obvious way possible.</p> 460 <h2 id="counter-arguments">Counter Arguments</h2> 461 <p><strong>But it is necessary to track errors so we can fix bugs and improve UX</strong></p> 462 <p>Yes, this is often the case. Does the Linux kernel collect logs? Yes! Do they upload them to a server for aggregation? No! This is how error logging should be done. Write your logs to a log file, but don’t automatically upload them to your servers. If a user has an issue that they would like addressed, they will let you know about it. If they don’t notice or don’t mind the issue, it’s their right to not report it. Some users may not want to deal with the hassle of uploading logs when things break, so they may prefer to have an option to automatically upload their logs. This is totally fine, but only if they are informed about what is being logged and it is an opt-in.</p> 463 <p><strong>But it is necessary to track usage to understand what users want</strong></p> 464 <p>No, it isn’t. GitHub (bleh) issues exists, Discord (ick) exists, Matrix exists, email exists, there are countless ways software projects crowd source improvements to their applications, but it should not be done using mass surveillance. I would argue it is acceptable to have an opt-in option to collect usage data, but I do wonder about the soundness of the minds of people who choose to opt-in to such surveillance.</p> 465 <h2 id="towards-a-solution">Towards a Solution</h2> 466 <p>Use applications that respect your privacy. If an application you are using collects your data and is not proprietary, it is quite likely there is a fork of it that strips out the data collection, see ungoogled-chromium [3] and LibreWolf [4] as examples. If one doesn’t exist, consider making one.</p> 467 <p>If user-respecting alternatives don’t exist and the application is proprietary, consider using WireShark [5] to see what domains the application is resolving. Once you find the data collection domains, add these domains to your /etc/hosts file or self-hosted DNS server (like a Pi-hole), and have them resolve to 0.0.0.0. This doesn’t always work because the domain that is collecting data is sometimes used for to support the core functionallity of the application, but in an ideal world this should not be necessary as you shouldn’t be using proprietary software to begin with.</p> 468 <h2 id="citations">Citations</h2> 469 <p>[1] - <a href="https://en.wikipedia.org/wiki/Cambridge_Analytica">https://en.wikipedia.org/wiki/Cambridge_Analytica</a></p> 470 <p>[2] - <a href="https://www.forbes.com/sites/kashmirhill/2012/02/16/how-target-figured-out-a-teen-girl-was-pregnant-before-her-father-did/">https://www.forbes.com/sites/kashmirhill/2012/02/16/how-target-figured-out-a-teen-girl-was-pregnant-before-her-father-did/</a></p> 471 <p>[3] - <a href="https://github.com/ungoogled-software/ungoogled-chromium">https://github.com/ungoogled-software/ungoogled-chromium</a></p> 472 <p>[4] - <a href="https://librewolf.net/">https://librewolf.net/</a></p> 473 <p>[5] - <a href="https://www.wireshark.org/download.html">https://www.wireshark.org/download.html</a></p>]]></description> 474 <pubDate>Sun, 12 Oct 2025 00:00:00 -0500</pubDate> 475 <guid>https://blog.laack.co/stop-collecting-user-data.html</guid> 476 </item> 477 <item> 478 <title><![CDATA[AdNauseum, Track Me Not, and Privacy Through Obscurity]]></title> 479 <link>https://blog.laack.co/adnauseum-track-me-not-and-privacy-through-obscurity.html</link> 480 <description><![CDATA[<h2 id="context">Context</h2> 481 <p>AdNauseum [1] is a fork of uBlock Origin [2] that hides ads, clicks them in the background, and aggregates the clicked ads in an easy to view interface. The key difference between UBlock Origin and AdNauseum is AdNauseum both hides and clicks ads.</p> 482 <p>Track Me Not [3] is a browser extension that mimics human search queries to obscure real queries in the noise.</p> 483 <h2 id="usability">Usability</h2> 484 <p>AdNauseum is as effective as uBlock Origin at hiding advertisements. For a user, there is no trade off in the usability of the web when compared with uBlock Origin. This is nice because more restrictive approaches to privacy, like GNU IceCat [4] and Tor [5], hinder modern web usage.</p> 485 <p>Similarly, Track Me Not has almost no impact on the usability of the web. I say almost no because the traffic it generates likely increases the probability of being shown CAPTCHAs, given that the traffic it generates is likely distributionally different than normal traffic.</p> 486 <h2 id="effectiveness-at-improving-privacy">Effectiveness at Improving Privacy</h2> 487 <p>AdNauseum is likely worse at protecting your privacy than UBlock Origin. By clicking ads in the background, there is an inherent trail of where you have been. In some ways this trail exists the moment the ad network sells the ad you are shown, but by using a more obscure technology than UBlock Origin, you are more likely to be fingerprinted. Despite this, AdNauseum makes the modern web a better experience to use than not having an ad blocker.</p> 488 <p>Track Me Not may also hinder privacy, depending on your privacy goals. The inherent problem is it is phoning home to search engines over time, giving them information about where you are. Search providers are also likely to fingerprint you on the basis of these strange searches. The possible saving grace is that by having so much noise in your search history, it could difficult to figure out what you are interested in. I am uncertain about the value of this though as there are likely going to be two search distributions; Track Me Not’s, and yours. This allows sophisticated search providers to ignore the synthetic requests and track your real requests while also gaining real time IP information.</p> 489 <p>In short, I find the idea that these tools improve privacy to be dubious.</p> 490 <h2 id="why-you-still-might-want-to-use-them">Why You Still Might Want to Use Them</h2> 491 <p>The value of these tools is they are a form of active resistance against ads and tracking. While your privacy is likely hindered by them, you are sending a message. That message costs ad networks and search providers money. In the case of AdNauseum, clicks are expensive for advertisers because most people ignore ads, and Track Me Not imposes computational costs on search providers. Even so, by clicking on so many ads ad networks may catch on and stop charging as much per click. Similarly, search providers may block you or start giving CAPTCHAs which likely impose less computational costs on them than running a query.</p> 492 <h2 id="my-thoughts">My Thoughts</h2> 493 <p>You probably shouldn’t be using them. While I enjoy active resistance, this is unlikely to be the right way to do it. It may mess with their knowledge about you if they are not sophisticated, but any sophisticated search provider or ad network, which I think most of them are, will easily sus out inauthentic traffic and gain more information about you as a result.</p> 494 <p>Instead of using these tools, I recommend doing the following to improve privacy:</p> 495 <ul> 496 <li>Use Tor when possible</li> 497 <li>Avoid sites that require signing in</li> 498 <li>Don’t use social media</li> 499 <li>Use a privacy respecting browser</li> 500 <li>Use UBlock Origin</li> 501 <li>Use a Pi-hole [6] and privacy respecting DNS servers</li> 502 <li>Minimize your usage of search engines</li> 503 <li>Use a variety of privacy respecting search engines</li> 504 <li>Use local AI tools (if you must use any at all)</li> 505 <li>Use E2EE messaging when possible</li> 506 <li>Minimize the trackability of financial transactions</li> 507 <li>Don’t carry a phone and minimize your usage of it</li> 508 <li>Avoid proprietary software and software that collects data</li> 509 </ul> 510 <p>This results in me doing the following:</p> 511 <ul> 512 <li>Using Tor for most of my traffic</li> 513 <li>Avoiding sites that require signing in</li> 514 <li>Not using social media sites</li> 515 <li>Using LibreWolf [7] as my default non-Tor browser</li> 516 <li>Routing all non-Tor DNS requests through a self-hosted Pi-hole with additional domain filtering</li> 517 <li>Using DuckDuckGo and a variety of public SearX instances for search</li> 518 <li>Running Ollama [8] models locally</li> 519 <li>Preferring communication with PGP encrypted emails, Matrix, or Signal</li> 520 <li>Using cash or Monero when possible for transactions</li> 521 <li>Not carrying my phone with me and only using it when it is the only means of achieving a specific goal (ie. SMS 2FA, communication with certain individuals, etc.)</li> 522 <li>Only using Libre software that doesn’t collect data</li> 523 </ul> 524 <p>Unfortunately there are sometimes exceptions to the above for the purpose of completing my work in an efficient manner, but in my personal life, I am unwilling to compromise on these things.</p> 525 <h2 id="citations">Citations</h2> 526 <p>[1] - <a href="https://github.com/dhowe/AdNauseam">https://github.com/dhowe/AdNauseam</a></p> 527 <p>[2] - <a href="https://github.com/gorhill/uBlock">https://github.com/gorhill/uBlock</a></p> 528 <p>[3] - <a href="https://github.com/vtoubiana/TrackMeNot">https://github.com/vtoubiana/TrackMeNot</a></p> 529 <p>[4] - <a href="https://www.gnu.org/software/gnuzilla/">https://www.gnu.org/software/gnuzilla/</a></p> 530 <p>[5] - <a href="https://www.torproject.org/about/history/">https://www.torproject.org/about/history/</a></p> 531 <p>[6] - <a href="https://pi-hole.net/">https://pi-hole.net/</a></p> 532 <p>[7] - <a href="https://librewolf.net/">https://librewolf.net/</a></p> 533 <p>[8] - <a href="https://ollama.com/">https://ollama.com/</a></p>]]></description> 534 <pubDate>Sat, 04 Oct 2025 00:00:00 -0500</pubDate> 535 <guid>https://blog.laack.co/adnauseum-track-me-not-and-privacy-through-obscurity.html</guid> 536 </item> 537 <item> 538 <title><![CDATA[The Sustainability of YouTube]]></title> 539 <link>https://blog.laack.co/the-sustainability-of-youtube.html</link> 540 <description><![CDATA[<h2 id="context">Context</h2> 541 <p>I dislike using cloud services because they may discontinue my service [1] or they may do something stupid [2] that negatively impacts me. These concerns, along with concerns about privacy [3], have led me to keep information and content I care about away from cloud services. This does make me wonder, how many people would be distraught about the loss of their content if YouTube terminated their accounts? This is not the topic today, nor is it something I can easily answer, but it is something I wonder about and would like others to consider.</p> 542 <p>Similarly, I am skeptical of “free” services. It’s incorrect to say “if something is free, you are the product” because charity does exist, but when it comes to Google, they aren’t a charity. Their current model with YouTube is to have people upload videos to their site and show ads to some users when they watch said videos. There are also paid subscriptions, but their primary monetization comes from ads. An important point is they don’t purge content on a regular basis, except in cases of ToS violations. As such, there is a (nearly) monotonically increasing function that describes the storage requirements of YouTube. This motivates my question below.</p> 543 <h2 id="question">Question</h2> 544 <p>When will YouTube’s storage costs exceed their revenue if they don’t start purging old content, assuming their revenue does not increase over time?</p> 545 <h2 id="how-to-answer-this-question">How to Answer This Question</h2> 546 <p>We need the following information to answer this question:</p> 547 <ul> 548 <li>What is YouTube’s annual net profit?</li> 549 <li>How much data does YouTube store?</li> 550 <li>How much does data storage cost?</li> 551 </ul> 552 <h2 id="youtubes-profit">YouTube’s Profit</h2> 553 <p>According to Alphabet’s 2025 Q2 earnings release [4], YouTube ads made a revenue of $9.769 billion. Annualized, this is $39.076 billion, but this is only revenue, not net profit. If we assume the operating margin across Alphabet matches the operating margin of YouTube (32%), we find an approximate net profit of $12.50432 billion / year. Actual net profit could differ from this, but since we are concerned with how much data storage this could support, we don’t need to factor in how this would be taxed.</p> 554 <h2 id="storage-needs">Storage Needs</h2> 555 <h3 id="total-videos">Total Videos</h3> 556 <p>YouTube states on their official blog there are over 20 million videos uploaded per day [5]. While I don’t trust YouTube very much, and they don’t have many incentives to be honest on this topic, they seem more trustworthy in this context than the slop factory sites as they are, in fact, the ones who are hosting the content. As such, I will accept this metric.</p> 557 <h3 id="average-video-size">Average Video Size</h3> 558 <p>I wrote a python script that uses a curated list of popular Google Trends searches over the past few decades [6] to search YouTube for recently uploaded videos. I ran this script and compiled a list of ~7.65 million YouTube videos.</p> 559 <p>Before continuing, I will list a few limitations of this approach:</p> 560 <ul> 561 <li>YouTube likely imposes some amount of algorithmic filtering when sorting by ‘recently uploaded’</li> 562 <li>The videos in question are all public (not inclusive of private/unlisted videos)</li> 563 <li>Less popular search terms may have a different distribution of video sizes</li> 564 </ul> 565 <p>These are the main flaws in my methodology, but any approach will be imperfect without being able to get the data directly from YouTube.</p> 566 <p>Of these 7.65 million videos, I sampled 615,222 of them and queried YouTube using <code>yt-dlp</code> [7] to find all video resolutions and formats YouTube will serve. It seems unlikely to me that YouTube stores each of these resolutions on their servers, but I think it is very likely that YouTube is storing the highest resolution version they are willing to serve to users.</p> 567 <p>Based on my findings, I propose a lower bound of ~396.17 MB / video, which assumes they are only storing the highest resolution version and all other versions are generated in real time via transcoding (I am confident this isn’t the case, but it provides a nice lower bound). I also propose an upper bound of ~1.44 GB / video, which assumes they are storing every resolution and format for each video they are serving.</p> 568 <p>All of the code used for this is available on my git server [8].</p> 569 <h3 id="annual-storage-increase">Annual Storage Increase</h3> 570 <p>Using my findings above about video size and YouTube’s stated video upload rate, we find:</p> 571 <p>Lower bound:</p> 572 <ul> 573 <li>7.923 PB / Day</li> 574 <li>2.89 EB / Year</li> 575 </ul> 576 <p>Upper bound:</p> 577 <ul> 578 <li>28.895 PB / Day</li> 579 <li>10.547 EB / Year</li> 580 </ul> 581 <p>Note: These values may vary depending on rounding, but they should be similar to what anyone else would find.</p> 582 <h2 id="storage-cost-by-volume">Storage Cost by Volume</h2> 583 <p>GCP currently charges $26 / month for 1 TB of standard multi-region, US based, cloud storage [9]. If we assume the same 32% profit margin as before, this would cost ~$17.68 / TB / month or $212.16 / TB / year. I don’t know if this is high or low relative to what they actually pay. YouTube requires quick access to many of their videos, but many of their videos are likely retrieved infrequently. Additionally, it seems likely Alphabet’s cloud storage margins are higher than the average margins across the organization. Additionally, these are only US storage prices so this could vary depending on the regions this data is being hosted in. In any case, I think this is a fair estimate.</p> 584 <h2 id="answer-to-the-question">Answer to the Question</h2> 585 <p>Given YouTube’s approximated net profit of $12.50432 billion / year and an estimated cost of $212.16 / TB / year for cloud storage, we find their profits can support an additional ~58.94 EB of data.</p> 586 <p>At the lower bound of 2.89 EB / year we find YouTube’s storage costs will surpass their current profits in ~20.39 years.</p> 587 <p>If we assume our upper bound of 10.547 EB / year we find YouTube’s storage costs will surpass their current profits in ~5.59 years.</p> 588 <h2 id="conclusion">Conclusion</h2> 589 <p>These are very rough bounds, especially given how difficult it is to estimate the cost per TB / year for storage of this data given their retrieval needs, but we find that in ~5.59 - ~20.39 years, YouTube will be forced to start purging old content to remain profitable at their current profit rate.</p> 590 <h2 id="citations">Citations</h2> 591 <p>[1] - <a href="https://killedbygoogle.com/">https://killedbygoogle.com/</a></p> 592 <p>[2] - <a href="https://arstechnica.com/gadgets/2024/05/google-cloud-accidentally-nukes-customer-account-causes-two-weeks-of-downtime/">https://arstechnica.com/gadgets/2024/05/google-cloud-accidentally-nukes-customer-account-causes-two-weeks-of-downtime/</a></p> 593 <p>[3] - <a href="https://www.gnu.org/proprietary/proprietary-surveillance.html">https://www.gnu.org/proprietary/proprietary-surveillance.html</a></p> 594 <p>[4] - <a href="https://www.sec.gov/Archives/edgar/data/1652044/000165204425000056/googexhibit991q22025.htm.md">https://www.sec.gov/Archives/edgar/data/1652044/000165204425000056/googexhibit991q22025.htm</a></p> 595 <p>[5] - <a href="https://web.archive.org/web/20250911091711/https://blog.youtube/press/">https://web.archive.org/web/20250911091711/https://blog.youtube/press/</a></p> 596 <p>[6] - <a href="https://www.kaggle.com/datasets/dhruvildave/google-trends-dataset">https://www.kaggle.com/datasets/dhruvildave/google-trends-dataset</a></p> 597 <p>[7] - <a href="https://github.com/yt-dlp/yt-dlp">https://github.com/yt-dlp/yt-dlp</a></p> 598 <p>[8] - <a href="http://git.laack.co/blog/log.html">http://git.laack.co/blog/log.html</a></p> 599 <p>[9] - <a href="https://cloud.google.com/storage/pricing#multi-regions">https://cloud.google.com/storage/pricing#multi-regions</a></p>]]></description> 600 <pubDate>Sun, 28 Sep 2025 00:00:00 -0500</pubDate> 601 <guid>https://blog.laack.co/the-sustainability-of-youtube.html</guid> 602 </item> 603 </channel> 604 </rss>