1 BILLION row challenge in Go - 2.5 Seconds!

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 พ.ค. 2024
  • In this video we look at how we can aggregate 1 billion rows of weather station data in as little time as possible. We start with a naive approach and optimize to go from 1m30 seconds to 2.5 seconds. Using the power of memory mapped files, a custom hash map implementation, and multiple Goroutines.
    Implementation: github.com/duanebester/1brc-go
    Thanks to Ben Hoyt
    benhoyt.com/writings/go-1brc/
    00:00 Intro
    00:54 Simple Implementation
    09:55 Advanced - Using mmap
    15:01 Custom integer parsing
    22:12 Parallel processing
    34:16 Custom hashmap
    42:48 Results
  • บันเทิง

ความคิดเห็น • 17

  • @ishaanrawal9327
    @ishaanrawal9327 23 วันที่ผ่านมา +1

    Hello Duane! This is some amazing stuff man! Keep making these and enlightening us! Thanks a lot!

    • @duanebester
      @duanebester  23 วันที่ผ่านมา

      Thanks, will do!

  • @kevinkim7068
    @kevinkim7068 23 วันที่ผ่านมา

    Thank you for blessing us🙏

  • @jonathanchapa4513
    @jonathanchapa4513 23 วันที่ผ่านมา

    As always, banger video! 🤤

    • @duanebester
      @duanebester  23 วันที่ผ่านมา

      You already know!

  • @cariyaputta
    @cariyaputta 11 วันที่ผ่านมา +1

    Thanks for sharing.

  • @eZe00
    @eZe00 23 วันที่ผ่านมา +1

    Nice video. However, you are calculating the average while you are meant to keep track of the mean of all the values. That means having an array in the struct to keep track of all the values seen. Subscribed!

    • @duanebester
      @duanebester  23 วันที่ผ่านมา +5

      I think “mean” in this case is the arithmetic mean, which is the same as the average; summing the numbers in the set and dividing by total count (per station). My output matches the baseline output so I feel pretty confident in the implementation

  • @ashersamuel958
    @ashersamuel958 20 วันที่ผ่านมา +2

    Great content, but the autopilot is taking the fun out of it

    • @duanebester
      @duanebester  20 วันที่ผ่านมา +1

      Great point. Will disable going forward!

  • @renkinjutsu01
    @renkinjutsu01 19 วันที่ผ่านมา +1

    It takes me 1 minute just to cat the file to /dev/null

    • @duanebester
      @duanebester  19 วันที่ผ่านมา

      Yep the aggregation calculations are what increases the time drastically

  • @keemykim92
    @keemykim92 23 วันที่ผ่านมา