From 586335a5e17a1c19a1d99c8fa1489f0702b4f9ab Mon Sep 17 00:00:00 2001 From: Damian Gryski Date: Wed, 4 Apr 2018 23:47:22 -0700 Subject: [PATCH] example padding striped mutexs from @egonelbre --- performance.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/performance.md b/performance.md index bfc928a..6f6b75d 100644 --- a/performance.md +++ b/performance.md @@ -965,6 +965,8 @@ readers in. If you're sharding the locks, be careful of shared cache-lines. You'll need to pad to avoid cache-line ownership bouncing between processors. +var stripe [8]struct{ sync.Mutex; _ [7]uint64 } // mutex is 64-bits; padding fills the rest of the cacheline + ## Assembly * Stuff about writing assembly code for Go