Plurrrr

week 17, 2022

Experience Report: 6 months of Go

I’ve been working at Sourcegraph for about 6 months now. During that time, I’ve mostly been writing Go, in the context of server-side development. I also gave a lightning talk on reading the Go spec at GopherCon.

During this time, I’ve been making notes of speed bumps I’ve run into, as well as things I’ve liked about Go. This post is an expanded version of those notes. I’ve tried my best to keep away from abstract examples, and focus on actual things I’ve run into myself.

Source: Experience Report: 6 months of Go, an article by Varun Gandhi.

First Steps with Nix - Building emacs

Unfortunately, nix still has a rather steep learning curve. I have been banging my head against the table quite a few times over the past week, and this is AFTER I printed the manual and read most of it :) In this note, I’ll take you along for the journey of a first more serios experiment: building the latest emacs, with a few extras enabled.

Source: First Steps with Nix - Building emacs, an article by Heinrich Hartmann.

Twelve-factor app anno 2022

The Twelve-factor app is a methodology for building software-as-a-service apps that was first formulated by developers associated with Heroku. It's been ten years since the first presentation of this methodology. Despite the criticism that it is only applicable to Heroku and similar webapp services, it remains a relevant yard stick for software-as-a-service development. Some of its tenets have been incorporated into Docker and thence into OCI, effectively making them the law of container-land. This blog post looks at each of the twelve factors and tries to evaluate whether they remain relevant or whether they need updating.

Source: Twelve-factor app anno 2022, an article by Anders Qvist.

We fixed f-string typos in 69 Python repos

We fixed the problems we found in 69 of the most popular open source Python repositories — repositories you probably know and might even use. At the bottom of this page is a list of the GitHub pull requests we created but for the sake of summary some were Tensorflow, Celery, Ansible, DALI, Salt, Matplotlib, Numpy, Plotly, Pandas, Black, readthedocs.org, Scipy, PyTorch, rich, and some repositories from Microsoft, Robinhood, Mozilla, and AWS.

Source: We fixed f-string typos in 69 of the most popular Python repos in only one day. Here’s how.

The Amazon Kindle will support EPUB in late 2022

Amazon has announced that all of the modern Kindle e-readers will support the most popular ebook format in the world, EPUB. The company recently updated their Send to Kindle documentation and stated that it will add support for EPUB later this year. Send to Kindle will suspend the ability to load in MOBI, since it is an older file format and won’t support the newest Kindle features for documents. If you have MOBI books already on your Kindle, they will continue to be accessible. Amazon is also disabling to the ability to send AZW to the Kindle.

Source: The Amazon Kindle will support EPUB in late 2022, an article by Michael Kozlowski.

The Matrix Resurrections (2021)

Return to a world of two realities: one, everyday life; the other, what lies behind it. To find out if his reality is a construct, to truly know himself, Mr. Anderson will have to choose to follow the white rabbit once more.

In the evening we watched The Matrix Resurrections. At first I didn't like the movie and was even considering to stop watching it. But then it slowly got a bit better. To me the worst Matrix movie: 6 out of 10.

2022 Mac Studio (20-core M1 Ultra) Review

Apple was kind enough to lend me a Mac Studio with 20-core M1 Ultra CPU (16 performance cores / 4 efficiency cores), 64-core GPU, 128GB unified memory, and an 8TB SSD. As spec’d, this is a $7999 system with all the bells and whistles, but a more modest $3999 system would lead to the same performance conclusions in this review.

Source: 2022 Mac Studio (20-core M1 Ultra) Review, an article by Craig A. Hunter.

No Time to Die (2021)

James Bond has left active service. His peace is short-lived when Felix Leiter, an old friend from the CIA, turns up asking for help, leading Bond onto the trail of a mysterious villain armed with dangerous new technology.

In the evening we watched No Time to Die. I liked the movie somewhat and give it a 7 out of 10.

When Python can’t thread: a deep-dive into the GIL’s impact

Unfortunately, in many cases Python can only run one thread at a time, due to what’s know as the Global Interpreter Lock (“GIL”). Other times it can run multiple threads just fine—it all depends on the specific usage patterns.

But which usage patterns allow parallelism, and which don’t? Naive mental models will give you inaccurate answers. So in this article you’ll build a practical mental model of how the GIL works:

  • We’ll start by going through a series of increasingly more accurate mental models of how the GIL works.
  • Then, we’ll see how our new, more accurate mental model can help you predict where and whether parallelism bottlenecks will occur.

Source: When Python can’t thread: a deep-dive into the GIL’s impact, an article by Itamar Turner-Trauring.

So Long Surrogates: How we moved to UTF-8 in Haskell

We released a blazingly fast Aho-Corasick implementation, written in Haskell, in 2019. This implementation was based on UTF-16 strings, since Haskell's text library uses that for its internal string representation. However, the most recent major update of text changed its internal string representation from UTF-16 to UTF-8. This is good news for us, since most of our customer’s data is ASCII, this update will cut our memory consumption in half. The big problem though is that our highly optimized string search library alfred-margaret assumes that its input is encoded as UTF-16 and uses that assumption to cut a few corners to improve performance. In this post we will illustrate the challenges we encountered implementing UTF-8 support in alfred-margaret and also give some insights into how we optimized our Haskell code for maximal performance.

Source: So Long Surrogates: How we moved to UTF-8 in Haskell, an article by Paul Brinkmeier.

Nix flakes, and how to convert to them

Most resources on nix flakes, however, assume you're starting a project from scratch. They don't give you much guidance about how to convert an existing nix project to flakes.

In this blog post, we'll do just that. With a further constraint: we'll keep the project working as a legacy nix project, and with relatively minimal changes. That way, people who prefer flakes can use flakes, people who don't can use legacy nix.

Source: Nix flakes, and how to convert to them.

Introducing zq: an Easier (and Faster) Alternative to jq

In the Zed project, we’ve developed a command-line tool called zq (and, yes, the name “zq” is a play on “jq”) that is based on an orthogonal set of dataflow operators.

Zed operators are like jq filters but they can be stateful. To make this work, we simply borrowed the aggregate function concept from the 50 year-old SQL model, though unlike SQL, Zed aggregate functions can stream their results incrementally.

In short, zq is based on stateful dataflow while jq is based on stateless dataflow.

Source: Introducing zq: an Easier (and Faster) Alternative to jq.

Generalizing Folds in Haskell

Have you encountered Haskell’s foldr function? Did you know that you can use it to express any function on a list? What’s more, there’s a way to derive similar functions for a large class of data types in Haskell.

Source: Generalizing Folds in Haskell, an article by Daniel Fedorin.

How macOS manages M1 CPU cores

CPUs in Apple Silicon chips are different, as they contain two different core types, one designed for high performance (Performance, P or Firestorm cores), the other for energy efficiency (Efficiency, E or Icestorm cores). For these to work well, threads need to be allocated by core type, a task which can be left to apps and processes, as it is in Asahi Linux, or managed by the operating system, as it is in macOS. This article explains how macOS manages core allocation in all Apple’s M1 series chips, in what it terms asymmetric multiprocessing (AMP, although others prefer to call this heterogeneous computing).

Source: How macOS manages M1 CPU cores, an article by Howard Oakley.

Dune

Set on the desert planet Arrakis, Dune is the story of the boy Paul Atreides, heir to a noble family tasked with ruling an inhospitable world where the only thing of value is the “spice” melange, a drug capable of extending life and enhancing consciousness. Coveted across the known universe, melange is a prize worth killing for....

When House Atreides is betrayed, the destruction of Paul’s family will set the boy on a journey toward a destiny greater than he could ever have imagined. And as he evolves into the mysterious man known as Muad’Dib, he will bring to fruition humankind’s most ancient and unattainable dream.

Last Saturday I watched Dune (2021) and today, in the evening, I started in Dune by Frank Herbert. I've read Dune in the past, several times even, but too long ago to have a fresh memory of it so a reread will be nice.