Monday, August 19, 2024

Go + ASM SIMD: Binary Search Tree

Go code can be made to run faster by using custom assembly code extensions, to leverage CPU instructions currently not supported by Go compiler (yet).

 Binary Search Tree with SIMD – ClĂ©ment Jean – Eternal learner and challenges lover

binary tree:

      ┌────── 41 ──────┐
      │                │
   ┌──23──┐       ┌───61───┐
   │      │       │        │
┌─11─┐  ┌─31─┐  ┌─47─┐  ┌─73─┐
│    │  │    │  │    │  │    │
2   19  29  37  43  53  67  79

SIMD: Single instruction, multiple data - Wikipedia

exploit data level parallelism, but not concurrency: there are simultaneous (parallel) computations, but each unit performs the exact same instruction at any given moment (just with different data).