Persistent Data Structures for Gophers: Persistent Stack

Persistent Data Structures for Gophers: Persistent Stack

Explore what immutable data structures are and how they can be used for fast concurrent programming

In this series of blog posts I would like to explore the world of immutable persistent data structures, their pros and cons compared to mutable data structures, cover in which scenarios we would want to use them and provide some theoretical background.

Image for post

First of all, let’s define what immutable data structure is. According to wikipedia:

In computing, a persistent data structure is a data structure that always preserves the previous version of itself when it is modified. Such data structures are effectively immutable, as their operations do not (visibly) update the structure in-place, but instead always yield a new updated structure.

We can immediately see several benefits compared to mutable counterparts:

  1. Since we don’t have mutable state, we don’t have to worry that the methods we call will accidentally mutate our variables
  2. We don’t have to use synchronization such as locks, which in theory should increase performance when the lock contention is high
  3. We have all versions of our structure, which can come very handy if we want to do something like undo-redo.

golang concurrency benchmark

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Golang Web Development:Th Best Programming Language in 2020

Golang Web Development is the new trend globally. Get all the details about the Golang development here. Hire Golang Developers.

How Benchmarking Your Code Will Improve Your Ruby Skills

Learning to code is a path full of struggles, and learning Ruby isn't the exception. But you'll agree with me, that practice is the best way to learn and develop your skills.

A Deep Dive Into Benchmarking in Golang

A deep dive into benchmarking in Golang. Go lets us developers benchmark using the testing package. In this article, I want to dive deeper into benchmarks in Golang, but I’ll start from scratch.

Golang Array Example | Arrays in Go Tutorial Explained

Golang array is a fixed-size collection of items of the same type. The items of an array are stored sequentially and can be accessed using their index.

Setting Up a GoLang Development Environment and Benchmarking

Our journey begins by installing GoLang. We create a development environment with the GoLang IDE, along with some associated tools and packages. Next, we list 19 “free” resources and 5 “not-free” books for learning the GoLang language. Finally, we benchmark the Python sklearn kmeans to GoLang kmeans implementation. Together, we will determine if the GoLang kmeans implementation works and if it is faster than the Python sklearn kmeans.