Tristan Penman's Blog

Tail Call Optimisation and C / C++

08 December 2018

At a recent Melbourne C++ meetup, the topic of tail call optimisation was raised. Tail call optimisation (or TCO) is a fascinating optimisation technique that is commonly discussed in the functional programming community, because of it’s importance in the implementation of efficient recursive algorithms. However, it is often overlooked when discussing other programming languages. This post gives brief overview of TCO, and looks at its use in C and C++ compilers.

Read more...

Extending Ruby with C++

16 September 2018

In my previous post, I covered the basics of writing a Ruby gem with native extensions. We saw how C can be used to enhance the functionality of the Ruby language. This post takes the idea a step further, and looks at how to extend Ruby with C++.

Read more...

Writing a Gem with native extensions

29 August 2018

There are many reasons you might want to write a Gem using native extensions. Performance is perhaps the most obvious. CPU heavy tasks, such as number crunching, can be re-written in C, to be many times faster than the equivalent Ruby code. For the daring among us, you can use multiple threads, GPUs, etc.

Read more...

Build your own workstation

17 April 2018

A recent endeavour of mine has been to build a Linux workstation, for my work in the Data Science and Machine Learning space. The primary technical requirement for this machine is full support for two GTX 1080 Ti graphics cards.

Read more...

Porting an Asteroids clone to JavaScript

08 January 2018

This post shares my experience porting an SDL-based Asteroids clone to the web, using Emscripten, an LLVM-to-JavaScript compiler.

Read more...

Sparsehash Internals

11 October 2017

One of the C++ topics that have I wanted to write about is Google’s Sparsehash library. Sparsehash provides several hash-map and hash-set implementations, in particular sparse_hash_map and sparse_hash_set, which have been optimised to have a very low memory footprint. This post dives into the details of how this is achieved.

Read more...

Fixing the authorship of a Git commit

11 December 2015

When working on code across multiple organisations, one problem that I have run into more often than I would like, is correcting the authorship of Git commits. You know the scenario - you create a new Git repository, but forget to set the appropriate user name and email address before a flurry of commits. This post covers one strategy that I have found useful for fixing incorrect Git commits.

Read more...

WordPress and Docker

01 December 2015

With so much of my recent work involving WordPress, it made sense to re-evaluate my workflow and figure out how it might be improved. This post shares some of the things I have found useful in setting up a Docker-based environment for WordPress.

Read more...

Implementing a Distributed Hash Table with Scala and Akka

26 November 2015

After diving into Scala and Akka earlier this year, I had been looking for an opportunity to apply what I had learnt to a non-trivial problem. The Chord Protocol seemed like a good place to start, and the project ultimately resulted in a talk at the Melbourne Scala User Group. Slides for my presentation, Implementing a Distributed Hash Table with Scala and Akka, are now available on Slideshare.

Read more...

Installing R and RStudio on Mac OS X

20 October 2015

Although installing R and RStudio on Mac OS X wasn’t particularly difficult, I thought I would make some notes here, in case they’re useful to someone else. These instructions make use of Homebrew, a convenient command line package manager for Mac OS X.

Read more...