expo

package module
v0.0.0-...-5b377e2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 0 Imported by: 0

README

Exercices in performance optimizations (expo)

Workshop at GOLAB 2024, 2024-11-11, 14:30, Martin Czygan, LI

Slides

Abstract

The 1 Billion Row Challenge is a simple, data-intensive task, that nonetheless allows to explore many optimization ideas and techniques in Go.

In this workshop, we start with a baseline implementation and interactively improve on the solution, learning about benchmarking, different performance characteristics of standard library types, concurrency patterns, fast data structures, useful operating system facilities and more.

Overview
  • Benchmarking
    • writing a benchmark
    • running a benchmark
  • Profiling
    • cpu profiling
    • generating a flame graph
  • 1BRC problem outline
    • problem description
  • A baseline implementation

Variations:

  • Caring about allocations
    • ReadString
    • Scanner
    • Scanner buffer size
  • Faster string parsing
    • splitting a string
    • parsing a float
    • parsing a float with SWAR
  • Parallel processing
    • worker pattern
    • splitting the file
  • Using memory-mapped files
    • simplifying the api
  • Using a custom hash table
    • custom hash table

Benchmarking mechanics

  • benchmark small snippets, separately
  • basic benchmark with time

Areas of optimization

  • buffered I/O
  • allocations, e.g. ReadString vs Scanner
  • better buffer sizes, e.g. as passed to Read(...)
  • parsing a string
  • parsing a float as int
  • using a memory-mapped file
  • parallel processing
  • optimal number of batch size and number of workers
  • custom hash function

Documentation

Overview

Package expo groups various implementations for 1BRC.

Directories

Path Synopsis
cmd
1brc-070-mmap-int-tweaks
instead of parsing float, parse an int instead
instead of parsing float, parse an int instead
1brc-076-mmap-int-za-key
instead of parsing float, parse an int instead
instead of parsing float, parse an int instead
1brc-080-mmap-int-static-map
instead of parsing float, parse an int instead; use a static mapping from names to slice indices; cheating as we can design the suitable, collision free mapping
instead of parsing float, parse an int instead; use a static mapping from names to slice indices; cheating as we can design the suitable, collision free mapping
1brc-401-baseline
R1: Basic building blocks, a struct, a map, a scanner.
R1: Basic building blocks, a struct, a map, a scanner.
1brc-402-avoid-double-hashing
R2: Avoid double hashing.
R2: Avoid double hashing.
1brc-403-avoid-parse-float
R3: Avoid parse float.
R3: Avoid parse float.
1brc-404-temp-int32
R4: Use int32
R4: Use int32
1brc-405-avoid-cut
R5: avoid cut
R5: avoid cut
1brc-406-no-scanner
R6: avoid scanner
R6: avoid scanner
1brc-407-custom-hash-table
R7: custom hash map
R7: custom hash map
1brc-408-parallel-baseline
R8: Parallel baseline
R8: Parallel baseline
1brc-409-parallel-opt
R9: Parallel baseline + optizations
R9: Parallel baseline + optizations
1brc-410-fast-semi
R10: fast semicolon find with SWAR, plus other optimizations
R10: fast semicolon find with SWAR, plus other optimizations
1brc-scratch
Playground to implement various ideas.
Playground to implement various ideas.
gen1brcdata
gen1brcdata generates sample data for 1BRC.
gen1brcdata generates sample data for 1BRC.
wip
x
bm
parsetemp
https://www.reddit.com/r/golang/comments/xv9yyv/strconvparsefloat_faster_altrernatives/
https://www.reddit.com/r/golang/comments/xv9yyv/strconvparsefloat_faster_altrernatives/

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL