Skip to content

Instantly share code, notes, and snippets.

@jpmcb
jpmcb / README.md
Last active November 25, 2020 17:42
Go state asyncrounous patterns

Performance in golang channels

These simple go tests check the "leaky-ness" of using channels in Go. There are two methods described here; one using both a local context, and the parent context. When tests are run against both, the LeakyAsync method runs faster, but fails the leak checker as goroutines are not resolved or cleaned up.

In a production system with possibly thousands of go routines being spun up, this could result in massive memory leaks and a deadlock situation in the go binary.

it's recommended to use the leakchecker library to determine if goroutines get cleaned up.

@jpmcb
jpmcb / index.html
Created December 30, 2016 19:40
World Clock and timer
<h1>Current Time</h1>
<h2 id="clock"></h2>
<div id="PomodoroTimer">
<div><h2>Pomodoro Clock</h2></div>
<div><h4 id="timerDisplay"></h4></div>
<div><button id="addTime">+</button></div>
<div><button id="pause">Start</button></div>