Singapore MRT/LRT in 2040

Station Mean Path Length in 2040

Expansion of the MRT/LRT rail network is a major part of the Singapore Land Transport Master Plan 2040. As the rail network would be over half a century old by then, I wanted to take a look at how its fastest available routes have changed in the past, and how we can expect them to change in the future. So here is a program to calculate the fastest path between any 2 train stations, similar to the countless travel mobile apps out there, but for all known and projected stages, from the initial launch in year 1987 to 2040 and beyond. ...more

11 min August 15, 2024 [General] #mrt #lrt
Speed up conda installs with mamba

Conda is an open-source package manager mainly used for managing Python environments.

Historically, installing and updating packages in conda environments was slow and tedious. This motivated QuantStack to create Mamba, a faster drop-in replacement solver for conda.

In December 2022, the conda project included mamba as a default solver, after 9 months in "experimental" status. This is great news for all conda users, however, mamba has to be manually installed and activated.

Here are 3 different ways to install mamba ...more

2 min January 03, 2023 [Python] #anaconda #conda #mamba
Efficient ASCII bitset in Go

Whenever we want to check a string for prohibited ASCII characters, such as in username validation, a simple method is to use a set of ASCII characters.

While other languages like Python and JavaScript have built-in sets, Go does not.

Instead, the natural way to implement sets in Go is to use the built-in map. With Go map, sets of any comparable variable type can be created.

import "fmt"

set := make(map[byte]struct{})

set[42] = struct{}{}

_, exists := set[42]
fmt.Println(exists) // expect: true

_, exists := set[99]
fmt.Println(exists) // expect: false

However, for sets of ASCII characters, the Go source code offers a faster solution, the asciiSet.

In this blog post, we shall build ASCIISet, an extension of asciiSet from the Go source code, from scratch. Afterwards, we shall compare its performance against traditional map based sets. ...more

6 min December 31, 2022 [Go] #Go #data #structures #bitset #rune