Skip to content

Instantly share code, notes, and snippets.

View corlinp's full-sized avatar

Corlin Palmer corlinp

  • ParaFi Capital
  • San Diego, CA
View GitHub Profile
@corlinp
corlinp / 1brc_corlinp.go
Last active March 5, 2024 07:24
1BRC in Go - corlinp
/*
Corlin Palmer's Go solution to the 1BRC coding challenge: https://github.com/gunnarmorling/1brc
- This solution reads the file sequentially as fast as possible (reader)
- It passes off the job of ensuring that each chunk ends with a complete line to another goroutine (lineSupervisor)
- The lineSupervisor sends valid chunks to a pool of worker goroutines (worker) which parse the data and calculate the results
- The results from the workers are collected in a map and then sorted before printing the final results
A fair amount of optimization has been done to reduce memory allocations.