Skip to content

Instantly share code, notes, and snippets.

View mcanalesmayo's full-sized avatar

Marcos Canales Mayo mcanalesmayo

View GitHub Profile
@smola
smola / k8s-jprofiler-attach.sh
Created March 23, 2018 14:49
Attach JProfiler agent to a JVM running in a Kubernetes pod
#!/bin/bash
set -e
if [[ -z ${K8S_JVM_POD} ]]; then
echo "K8S_JVM_POD not defined"
exit 1
fi
EXEC="kubectl exec ${K8S_JVM_POD}"
CP="kubectl cp ${K8S_JVM_POD}"
@psayre23
psayre23 / gist:c30a821239f4818b0709
Last active April 15, 2024 14:39
Runtime Complexity of Java Collections
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
---------------------|------|--------|------|----------|------|---------------
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array
@jboner
jboner / latency.txt
Last active April 16, 2024 03:40
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD