news
Programming Leftovers
-
Victor Zverovich ☛ The fastest double-to-string algorithm you’ve never heard of
Żmij, the binary-to-decimal conversion library I wrote about a few posts back, started as an optimized port of Schubfach. Later I switched its core to a different algorithm, defined in yy_double.c from yyjson by ibireme. It has no paper, no name beyond the file it lives in (I'll refer to it as yy), and almost no public profile outside the JSON performance crowd. It also happens to be one of the fastest dtoa implementations.
This post is a tour of yy through a small visualization, with a close look at one boundary case.
-
Raphael Amorim ☛ Closing Canario Terminal source code
People underestimate what open source costs from the maintainer side. It’s not just writing code. It’s issues, pull requests, discussions, people demanding things from you for free. I got spammed like crazy. And now with AI, spamming a maintainer is so easy: low effort issues, generated pull requests, and every single one of them takes a bit of your time and energy.
Three things I want to make clear: [...]
-
Jacob Tomlinson ☛ Open Source libraries are evolving into reference implementations
I’ve spent the majority of my professional career working on software libraries, chunks of reusable code that other people stack together to make their code.
Libraries are valuable because they contain common code that gets reused a lot, code that has been heavily tuned for performance, or code that captures a niche domain that would be cumbersome to rewrite. Libraries exist to save people time. Open source libraries also add benefit by having many people contributing on a common codebase fixing bugs, improving performance and increasing correctness.
-
James Bennett ☛ Breaking up (lines) is hard to do
Here’s a seemingly simple question: given a chunk of multi-line text, how do you split it and return an array whose members are the constituent lines of the text?
Hopefully, your first instinct is to reach for some sort of standard-library function, maybe something like the splitlines() method of Python’s str type. Because it turns out this “simple” question is actually pretty complex to answer! For example, quite some time ago I read a post by William Woodruff pointing out the surprising discovery that Python treats up to eleven different Unicode code points or code point sequences as indicating a line break.
At the time I meant to write about that, but a lot of other things started fighting for my time, and it’s only now that I’m finally digging it out of my drafts. Still, better late than never, so today let’s dig into some of the many ways there are to break a line of text and how they’ve been standardized and specified and ultimately wound up in the set Python uses.
-
Dmitrii Kovanikov ☛ 8 months of OCaml after 8 years of Haskell in production
I’ve been using Haskell in production for 8 years. I’ve been using OCaml in production for 8 months.
It’s time to compare those two languages.
-
R / R-Script
-
Rlang ☛ Dual scaled y-axis with ggplot()
I have often found myself needing to plot a single graph with two y-axes having different scales. For example, this might be useful for representing temperature and rainfall data at a given location. Unfortunately, doing this with ggplot() is not straightforward.
While searching for possible solutions, I discovered that graphs with dual y-axes are generally not regarded as good tools for data visualisation. Hadley Wickham, the author of ggplot2 and several other important R packages, has given some good reasons for this (e.g., at this link). I do not intend to question these general arguments. Nonetheless, the idea that I cannot do with ggplot() something that I could easily do with Excel gets on my nerves. After all, such graphs can be quite useful in some specific circumstances, such as when displaying weather data.
I therefore started looking for a reasonable solution and eventually found my way. I would like to share it in this post.
-
-
Python
-
Juha-Matti Santala ☛ I is for immutable - Python A to Z
Then at some point — maybe at an advanced class at the university, at a meetup or in the always peaceful and polite discussion forums on the web — you’re introduced to the idea of immutability (not capable of or susceptible to change).
Someone comes hype the idea of functional programming that you’ve never heard of. They start talking about how changing variable state is so error-prone and pure functions is where the game should be played at.
-
Juha-Matti Santala ☛ J is for JSON validation - Python A to Z
When you need to load external data into your software, you want to make sure it behaves properly, ie. it’s in correct form. One tool to validate input data is Pydantic. This is a quick tutorial to show how it works.
-
Eric Matthes ☛ Parsing large(ish) data files
There are many tools for exploring game collections, but I've just started to become familiar with these tools. I'm guessing people have made tools for exploring large collections efficiently, but I haven't found them yet. I'll do a more thorough search for existing tools when I have a bit more time, but for now it's kind of fun to come up with my own ways to handle these larger files.
In this post, I'll share the challenge I've come across with a naive approach to parsing large game files, and share a more efficient approach I've been curious to explore.
-