According to Jackie Stewart, a three-time world champion F1 driver, having an understanding of how a car works made him a better pilot.
“You don’t have to be an engineer to be a racing driver, but you do have to have Mechanical Sympathy”
Martin Thompson (the designer of the LMAX Disruptor) applied the concept of mechanical sympathy to programming. In a nutshell, understanding the underlying hardware should make us a better developer when it comes to designing algorithms, data structures, etc.
In this post, we will dig into the processor and see how understanding some of its concepts can help us when it comes to optimizing solutions. …
A couple of months ago, I wrote a post about Go and CPU Caches: https://teivah.medium.com/go-and-cpu-caches-af5d32cc5592
Then, I wanted to extend the scope of this post. Following this idea, I had the chance to give a talk to GopherCon Turkey 2020. The topic is the following: Mechanical Sympathy in Go.
I tried to cover the following topics:
Here is the video of my talk:
The beginning of the talk was unfortunately ousted. Yet, you can find the slides here for the missing introduction:
In an unsorted array of integers, every element appears twice except for one element that appears only once. Return this element.Example:Input: a=[1, 4, 2, 4, 1, 3, 2]
Output: 3
Video:
With the rise of distributed architectures, consistent hashing became mainstream. But what is it exactly and how is it different from a standard hashing algorithm? What are the exact motivations behind it?
First, we will describe the main concepts. Then, we will dig into existing algorithms to understand the challenges associated with consistent hashing.
Hashing is the process to map data of arbitrary size to fixed-size values. Each existing algorithm has its own specification:
Hashing has many applications in computer science. For example, one of these applications is called checksum. To verify the integrity of a dataset it is possible to use a hashing algorithm. A server hashes a dataset and indicates the hash value to a client. Then, the client hashes its version of the dataset and compare the hash values. …
In ReactiveX, the two main concepts are the Observer and the Observable.
An Observable is a bounded or unbounded stream of data. An Observer subscribes to an Observable. Then, it reacts to whatever item the Observable emits. …
I wanted to let you know that I just released Algo Deck. It is a free & open-source collection of +200 algorithmic cards.
Each card is a synthesized way to describe a concept. For example:
Let’s take a look at the Go package in charge to provide synchronization primitives: sync
.
sync.Mutex
is probably the most widely used primitive of the sync
package. It allows a mutual exclusion on a shared resource (no simultaneous access):
It must be pointed out that a sync.Mutex
cannot be copied (just like all the other primitives of sync
package). If a structure has a sync
field, it must be passed by pointer.
sync.RWMutex
is a reader/writer mutex. It provides the same methods that we have just seen with Lock()
and Unlock()
(as both structures implement sync.Locker
interface). …
This post is a summary of my 2-day experience at GopherCon UK 2019. I did not attend the first day (workshops only).
Disclaimer: In this post, I am expressing my opinions about some talks. Under no circumstances, I am making a value judgment on the speakers.
The conference started with a keynote from @JQiu25 who’s working at Google in the Go team.
She described the 3-step process when it comes to working with an external open-source library:
About