Writings about software development.

Practical Tips for Advanced Git Bisect

Practical Notes on Advanced Git Bisect This is an adaptation from my Twitter thread: Git bisect ✂️ a thread 🧵. — Christoph Siedentop (@chsiedentop) November 20, 2020 Recap of Bisect I assume you’ve used or heard of git bisect. If you’ve neither heard off nor used git bisect before, then I encourage you to give it a try. Franziska Hinkelmann provides a good intro and a test repo to find a bug with git bisect.

Optimizing C++ Word Count

Yesterday’s post showed that the original C++ version is around 13 times slower than my non-optimized Rust version. Next, I’ll show how to get easily equivalent performance to Rust. One problem that I immediately made out when first seeing the C++ version is that it uses std::regex. std::regex is known to be horribly slow 1. Just replacing the checking of the file name extension with the in-built e.path().extension() != ".txt" speeds up from 373 ms to 52ms!

Swift Word Count

Yesterday, I wrote about implementing word-count in Rust. Having never written Swift before1, I wanted to try my hand at the same problem. This is certainly not comparable to my Rust version or the C++ version 2. Doing this in Swift just consisted of constant googling and the result is certainly not what a proficient Swifter would write. Getting started I created a new Swift package, and built it in the command line.

Rust Word Count

Last week there were two posts on the reputation of C++. In a noble effort, Jussi Pakkanen showcased modern C++. Nothing fancy, just clean and readable code. Unfortunately, around ten years after C++11, the news that simple (and safe) C++ code is now the default has not spread everywhere. Jason Moiron answered with Go code doing the same (article). Both programs find the ten most common words in all txt files, which can be recursively found in the current directory.

Sentry and C++

Crash Reporting If your program is running on more than one machine or is used by others, you probably want to get some insight into when things fail. I believe this is commonly called “Crash Reporting”. Such a crash reporting system will consist of a component to collect individual incidents and of a component to aggregate individual reports. For example, it will group common incidents by stack trace. One public example of this, is Mozilla’s system (Socorro).

Nushell vs Bash

After last week’s post on how Nushell can be used to convert unstructured data to structured data, I wondered how I would approach the task using traditional tooling. I wrote ‘Bash’ in the title, but what I precicesley mean is POSIX pipes and command line utilities typically found on a Unix-like environment (Linux, macOS, etc). Again, the task is to convert weirdly structured text output (from sshping) to JSON for further processing or long term storage.

Converting Command Line Output to JSON with Nushell

Nushell Nushell is pretty great. It’s a new shell that has as its biggest selling point the fact that pipes are inherently structured. I’ve been playing around with version 0.13.0 and was able to find a few rough edges. But I really will be using this in the future. Often, I am torn between writing scripts in Bash or Python. Python is obviously much saner for bigger tasks. But Bash operates nicely with the POSIX world and pipes are just great.