RSSAmplifier

Blog

Daniel Monteiro's blog

Recent content on Daniel Monteiro's blog

dfamonteiro.comRSS feed ↗22 posts

Latest posts

Fixing dotnet-trace's 100 stack frame limit once and for all

I’ve had enough of workarounds for dotnet-trace ’s limit of 100 stack frames. 
 Just to recap from my previous misadventures , if you attach dotnet-trace to your application and your application has, for example, a call stack 120 calls deep, the “root” 20 stack frames get cut from the call stack that dotnet-trace receives, and you end up with completely unusable traces…

John Ousterhout's "A Philosophy of Software Design" is a must-read book

Software engineers are not a fungible commodity. Two people could be of the same age, graduate from the same course, have the exact same work experience, have the exact same life experience… and one of them writes much more elegant code than the other. How does this happen? Do some people just have an innate ability to write better structured code than others? Can this be taught? 
 What…

Crafting a Zero-Capacity Multi-Producer-Multi-Consumer queue in async C#

In recent times, I have been putting some thought into designing a load generator that simulates queued-based manufacturing processes - think car assembly lines or SMT lines . A key detail about these types of setups is that they’re susceptible to traffic jams: if a station at the end of the line breaks, the entire line backs up until the problem is fixed. 
 The intrinsically linear…

Embedding SQL queries in dotnet-trace-generated trace files: the Good, the Bad and the Ugly

A couple of weeks after I published my guide on getting the most out of dotnet-trace , I started having a nagging thought in the back of my mind: could we do even better? And by “better” I mean capturing information on which SQL queries are being executed by our .NET application. 
 So, is it possible? Yes! Is it easy and convenient? …Not really. 
 
 The…

Formula Onigami - The case for Scorigamis in Formula 1

If you happen to be both a sports fan and slightly too addicted to youtube, you might have come across the term Scorigami - a concept invented by Jon Bois to denote “the act, and art, of producing a final score in a football game that has never happened before” . These Scorigamis were originally just funny statistical oddities, but after Secret Base’s viral video essay on…

Diagnosing performance issues in .NET applications with dotnet-trace and Perfetto

As the software industry transitioned towards more cloud-centric environments, programming languages have had to focus on treating virtualized Linux environments as first-class citizens or risk getting left behind. C# was no exception and for this language to maintain its popularity, Microsoft had to perform a complete overhaul of the .NET runtime to make it cloud-ready. 
 As part of this…

Working around dotnet-trace's 100 stack frame limit

2026-08-05 update: The workaround detailed in this blog post has been superseded by a bespoke version of dotnet-trace I developed that directly addresses this issue at the source . 
 The dotnet-trace command line tool is a rather neat piece of technology: by taking advantage of the .NET runtime’s EventPipe component, it is able to collect tracing data in a way that is both consistent and…

Reviewing a year's worth of book reading

As we’re nearing the end of the calendar year, I wanted to reflect on the books I’ve read in these past 12 months. And thankfully, I had the foresight of taking notes throughout the year! Yay, past me! 
 This won’t be a normal blog post in my usual writing style, but I’ll keep it simple: the books are organized by theme… that’s it. 
 Let’s get…

The case for stateful load generators

One can usually tell the importance of a certain piece of software by the amount of effort it goes into testing it. In no other place is this more true than the automotive, medical, and aerospace 1 industries: the criticality of software in these contexts leads to their development having to be compliant to international safety standards such as ISO 26262 and IEC 62304 , which include extensive…

Analysing karting lap times for fun and profit

Recently, as part of a team-building activity, me and a bunch of work colleagues went to a karting track. The format was quite simple: 5 minutes of practice/qualifying, followed by a 15 minute race. I went to this karting affair with absolutely no racing experience other than playing Gran Turismo 5 1 and watching way too much Formula 1, and did pretty well in qualifying, starting P3! Unfortunately…

Solving the mathematics of Factorio Quality: Recycler-Assembler Loop


 The recycler-assembler loop is probably the most commonly used quality grinding method in Factorio. It is a two step looping process where in the first step, the ingredients are crafted by an assembler into items, which are then recycled back into ingredients. By having quality and productivity 1 modules in both the assembling and the recycling steps, the quality and items and…

Solving the mathematics of Factorio Quality: Asteroid Chunk Recycling


 Asteroid chunk recycling is one of the the most effective methods to get legendary resources in Factorio. It is one of the more unique quality grinding setups you’ll ever find, but the calculations needed to assess the efficiency of this method are quite straightforward, as it will be shown in this blog post. Please note that I will assume that the reader has read my analysis of…

Solving the mathematics of Factorio Quality: Pure Recycler Loop


 The pure recycler loop is the simplest possible way to grind for legendary items, making it the logical next step of our quality analysis journey. Armed with the knowledge we gained from the previous post of this series , we’re going to calculate the efficiency of this quality grinding method and do some statistical analysis of how the production of quality items is affected by…

Solving the mathematics of Factorio Quality: The Fundamentals


 Prologue
 
 
 Link to heading 
 
 
 Video games have this incredible ability to evoque certain feelings and states of mind on the people that play them. You can experience pretty much every emotion, starting from happiness, amazement, and wonder going all the way to sadness, frustation, and heartbreak. Games can make you laugh and…

Solving the Jindosh Riddle with constraint programming

I was playing Dishonored II, when I came across a locked door. In order to make progress in the game, I had to open this door. When you get close to it, you begin to realise that there is more to this door than it first meets the eye: 
 
 
 The Jindosh Riddle door lock 
 
 There is no key that opens this door. Instead, you have 5 slots with names and 5 slots…

Applying clustering techniques to the F1 2024 schedule for fun and profit

I was finishing my Formula 1 Cornering Performance Breakdown project when I came up with the idea of using the existing code infrastructure to generate cornering data for every track on the 2024 calendar. As part of that project, I tagged every corner with a tag highlighting how fast that corner is. With that information, I can determine how much time is spent on each type of corner. The remainder…

The Formula 1 ATR rules have to account for dominance

Dominance is a common occurrence in Formula 1. While most other forms of motorsport have made efforts to limit the amount of design freedom that teams have (to save costs), F1 and MotoGP swim against the current and remain the only premier competitions where pretty much everything is bespoke 1 . This leads to the creation of incredible works of engineering in the form of the fastest racing bikes…

Formula 1's cost cap could be improved: here's how

The introduction of the cost cap in Formula 1 has allowed teams to do something they aren’t exactly well known to do: turning a profit. F1 teams suddenly had a business case that made sense for the first time since the inception of the sport and instantly saw their valuations skyrocket. It has also meant that the bigger F1 outfits have had to downsize to fit the cost cap, which led to a…

Can Formula E race at Macau?

When it comes to historical races, the Monaco Grand Prix is definitely an odd one. Older than Formula 1 itself, it is F1’s most glamorous and most prestigious race on the calendar, featuring a track layout that remains largely unchanged 1 since the race’s inception in 1929. Unfortunately, when it comes to on-track action, it is an absolutely dreadful race, with cars that are impossible…

How soon can a driver clinch the title: a nuanced analysis

The 2020 Formula 1 championship was one of the most uncompetitive seasons in recent history. Facing an underpowered Ferrari 1 and a RedBull plagued with rear instability problems, Mercedes in some people’s eyes had already won the title 2 before even turning a wheel in a free practice session. Lewis Hamilton, however, did need to beat his teammate Valttery Bottas in order to win the…

Developing an intermediate representation of Brainfuck using Rust

Brainfuck is an interesting programming language, to say the least. As the most prominent Esoteric programming language out there, it provides a truly cursed programming experience. It is quite minimalistic as well, featuring only 8 distinct instructions and a programming model that can be best described as a glorified Turing machine , making writing a Brainfuck compiler an interesting programming…

About

I’m a software engineer with a MSc in Informatics and Computer Engineering @ FEUP 
(Faculty of Engineering of the University of Porto). I am currently working at Critical Manufacturing . 
 I am currently interested in multithreaded programming, rocket control, orbital dynamics and in analysing mega constellations as distributed systems. As a fan of motorsport (F1, MotoGP, WEC, etc),…