Skip to content

Instantly share code, notes, and snippets.

💭
Teaching my kid game programming using Pico-8 fantasy console

Ralph Caraveo III deckarep

💭
Teaching my kid game programming using Pico-8 fantasy console
Block or report user

Report or block deckarep

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@deckarep
deckarep / keybase.md
Created Mar 18, 2019
My keybase ya’ll
View keybase.md

Keybase proof

I hereby claim:

  • I am deckarep on github.
  • I am deckarep (https://keybase.io/deckarep) on keybase.
  • I have a public key ASCILfCZPwyCR_n1T7aot_Nq9xjLhXrkYoKZRX-deNXGrwo

To claim this, I am signing this object:

@deckarep
deckarep / index.html
Created Nov 18, 2017 — forked from kirjavascript/index.html
d3 webGL force graph with PIXI.js
View index.html
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<title>d3 webGL force graph with PIXI.js</title>
<meta name="description" content="">
<meta name="theme-color" content="#000000">
</head>
<body>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default"></script>
@deckarep
deckarep / concurrent_bench.go
Created Sep 10, 2017
Concurrent benchmarks of both sync.Map and a regular RWMutex locked map.
View concurrent_bench.go
func benchmarkRegularStableKeys(b *testing.B, workerCount int) {
runtime.GOMAXPROCS(workerCount)
rm := NewRegularIntMap()
populateMap(b.N, rm)
var wg sync.WaitGroup
wg.Add(workerCount)
// Holds our final results, to prevent compiler optimizations.
@deckarep
deckarep / load_bench.go
Last active Sep 10, 2017
Benchmark of sync.Map vs builtin map with Load operations
View load_bench.go
func BenchmarkLoadRegularFound(b *testing.B) {
nums := nrand(b.N)
rm := NewRegularIntMap()
for _, v := range nums {
rm.Store(v, v)
}
currentResult := 0
b.ResetTimer()
@deckarep
deckarep / delete_bench.go
Last active Sep 10, 2017
Benchmark sync.Map vs regular RWMutex map
View delete_bench.go
func BenchmarkDeleteRegular(b *testing.B) {
nums := nrand(b.N)
rm := NewRegularIntMap()
for _, v := range nums {
rm.Store(v, v)
}
b.ResetTimer()
for _, v := range nums {
rm.Delete(v)
@deckarep
deckarep / store_bench.go
Last active Sep 10, 2017
Benchmark sync.Map vs regular map for Stores
View store_bench.go
func nrand(n int) []int {
i := make([]int, n)
for ind := range i {
i[ind] = rand.Int()
}
return i
}
func BenchmarkStoreRegular(b *testing.B) {
nums := nrand(b.N)
@deckarep
deckarep / sync_map_usage.go
Last active Sep 10, 2017
Usage of sync.Map
View sync_map_usage.go
func syncMapUsage() {
fmt.Println("sync.Map test (Go 1.9+ only)")
fmt.Println("----------------------------")
// Create the threadsafe map.
var sm sync.Map
// Fetch an item that doesn't exist yet.
result, ok := sm.Load("hello")
if ok {
@deckarep
deckarep / regular_map.go
Created Sep 10, 2017
Regular Thread-Safe Int Map
View regular_map.go
package RegularIntMap
type RegularIntMap struct {
sync.RWMutex
internal map[int]int
}
func NewRegularIntMap() *RegularIntMap {
return &RegularIntMap{
internal: make(map[int]int),
@deckarep
deckarep / main.go
Created Sep 6, 2017
Debouncing Queues in Go
View main.go
package main
import (
"fmt"
"math/rand"
"os"
"os/signal"
"sync/atomic"
"time"
)
@deckarep
deckarep / unsafe_before_mutex.go
Last active Dec 22, 2016
Unsafe without the use of locks
View unsafe_before_mutex.go
package main
import (
"fmt"
"math/rand"
"time"
)
const totalEnemies = 1
You can’t perform that action at this time.