Today I’d like to share a few thoughts on a few new profiling features we recently shipped at Datadog. I’ll explain what they do, how they work, and which Go 1.18 contributions were needed in order for things to work well. Feature Showcase Let’s start with the end result. Imagine you have a 100ms trace where 10ms are spent on a database query, but 90ms remain unexplained. When…
Without doubt, Go 1.18 is shaping up to be one of the most exciting releases since Go 1. You’ve probably heard about major features such as generics and fuzzing, but this post is not about that. Instead we’ll talk about profiling and highlight a few noteworthy improvements to look forward to. A point of personal joy for me is that I was able to contribute to several of the improvements…
It seems like my previous post has struck a chord and many of you have sent your own solutions via twitter . Before I move on to pick another day as a challenge, I’d like to do a little follow up for day 1-1. Valentin Deleplace’s Solution Let’s start with looking at the winning solution from Valentin Deleplace which achieves a spectacular 13.8 ns/op on my machine. This is 6.5x…
Tis the season to be geeky, so it’s time for Advent of Code 2021 . My theme for last year was to learn some rust , but for this year I decided to focus on Go profiling. The idea is to code up naive solutions and use Go profiling tools to optimize them. A few folks on twitter were interested in seeing the results as blog posts, so I’m hoping to write a few of these. You can find all…
tl;dr: Here is my boilerplate for reading and writing CSV files in Go. I hope you’ll find it useful. Every once in a while, I have to read and/or write CSV files in Go. In theory that’s easy. One just has to include encoding/csv from the standard library, and write a bit of boilerplate to map between a Go struct and the CSV records. However, the resulting code has often left me…
Finite-state machine (FSM) is a wonderful model of computation that has many practical applications. One of my favorites is turning business logic into simple FSMs. For example consider the following requirements for an order management system: Orders must not ship before they are paid. Orders can be canceled, but only if they haven’t shipped yet. An order that has already been paid, needs…
I am currently dabbling in PostgreSQL internals in my spare time, including trying to understand the query planner and executor. It’s a deeply humbling experience, but occasionally I’m delighted to be able to answer simple questions I’m researching. One of these questions is how PostgreSQL is executing ORDER BY clauses inside of aggregate expressions. # CREATE TABLE foo AS SELECT…
Invented in 1959, the snooze button is the worst invention in the world. Not only does it defeat the point of setting an alarm, it may actually leave you more tired . Unfortunately however, my zombie morning brain doesn’t care about this, and any alarm within reach has a very poor chance of actually getting me out of bed, trapping me into an open-end snooze fest. For this reason I usually…
If you have ever written some TCP socket code, you may have wondered: “What will happen to my connection if the network cable is unplugged or the remote machine crashes?”. The short answer is: nothing. The remote end of the connection won’t be able to send a FIN packet, and the local OS will not detect that the connection is lost. So it’s up to you as the developer to…
Merry Christmas (or Newtonmas if you prefer) everybody. Today I’m very happy to release the first version of my favorite side project, GoDrone. GoDrone is a free software alternative firmware for the Parrot AR Drone 2.0 . And yes, this hopefully makes it the first robotic visualizer for Go’s garbage collector : ). At this point the firmware is good enough to fly and provide basic…
Update: The fugitive vim plugin supports the same feature via :Gbrowse - thanks to @CrypticSwarm for the tip! In my never-ending quest to automate my work flow, I recently came up with a neat little vim trick I’d like to share. One of the things I do quite frequently, is pasting links to GitHub files/lines in email and chat conversations, e.g. Protocol.js#L144 . So far my workflow for this…
tl;dr: We are creating an open source project to provide a turnkey file uploading solution called tus . Today we are happy to show you our first resumable file uploading demo . It’s 2013, and adding reliable file uploading to your app is still too damn hard. And if content is king, this poses a serious problem to those interested in acquiring it. In this post I’ll describe the current…
After writing about Open Source And Responsibility , I’d like to share a small collaboration hack I came up with last year. Here it is: Whenever somebody sends you a pull request, give them commit access to your project. While it may sound incredible stupid at first, using this strategy will allow you to unleash the true power of Github. Let me explain. Over the past year, I realized that I…
Today I read a comment on Github about an important feature that is missing in one of my open source libraries. I won’t link to it, but it basically said: “If you care about your library and the community, you must implement this feature”. These were not his exact words, but author of the comment was clearly demanding more gratis attention for his problem based on my…
After writing over 300 articles between 2006 - 2009, I went on a bit of a blogging hiatus for the past three years. This was mostly because node.js took off, and being one of the first contributors sent a steady stream of speaking opportunities my way. This was a lot of fun, but at this point I am a bit sick of traveling, and I have also realized that conferences are not a good platform to share…