Learning Golang: Introduction to Benchmarks

Описание к видео Learning Golang: Introduction to Benchmarks

In this episode I will introduce you to Benchmarks in Go/Golang, they are great way to determine how fast/slow a piece of code is.

To use benchmarks in Go we have to import the "testing" package of the standard library, the important bits to know to get started are:

■ Import the "testing" package,
■ Prefix your benchmarks with "Benchmark", making sure the function receives "*testing.B", for example "BenchmarkConcat(b *testing.B)"
■ The implementation of the benchmark is via for loop, do not use the value of "b.N" of your tests because that's non-deterministic

There are other advanced ways to work with benchmarks that I will cover in future episodes, like:
■ ResetTimer
■ StopTimer
■ StartTime

== Relevant links

■ Example code: https://github.com/MarioCarrion/video...
■ Testing in Go/Golang:    • Testing in Golang/Go  
■ Learning Go/Golang :    • Learning Go/Golang  
■ https://pkg.go.dev/testing#hdr-Benchm...
■ https://pkg.go.dev/golang.org/x/perf/...
■ direnv – unclutter your .profile: https://direnv.net/

== All Go/Golang Playlists

■ Learning Relational Databases in Go/Golang:    • Learning Go/Golang: Relational Databases  
■ Learning Concurrency Patterns in Go/Golang:    • Learning Go/Golang Concurrency Patterns  
■ Go/Golang Tools and Packages:    • Golang/Go Tools and Packages  
■ Building Microservices in Go/Golang:    • Building Microservices in Golang/Go  
■ Software Architecture in Go/Golang:    • Software Architecture and System Desi...  

== Socials

■   / mariocarrion  
■   / mario.carrion  
■   / mariocarrion  

00:00 - Start
00:15 - How to build Benchmarks in Go/Golang?
05:55 - Important arguments when running Benchmarks in Go/Golang
10:08 - Using benchstat to compare Benchmarks results
17:05 - Conclusion regarding Benchmarks in Go/Golang

00:17 - modules card

=== Who am I?

Hello👋🏼! I'm Mario, a Hands-on Software Architect and Lead Backend Engineer with more than 16 years of professional experience building all kinds of software including on-premise Industrial Automation Systems, Linux Accessibility Desktop and Browser Components as well as Distributed Advertising Microservices.

Every week I will share with you different topics I've learned while working for small startups and large companies including the processes I've followed over the years for successfully delivering complex enterprise systems from start to end.

Subscribe if you like Software Development, Software Architecture and Systems Design!

Keep it up. Don't give up!

#golang #tutorial #beginner

=== Our Vlog Channel

   / rubycarrion  

=== Our affiliate links below

■ My Amazon Storefront: https://www.amazon.com/shop/rubycarrion
■ Shop my IG posts on my shopLTK page: https://www.shopltk.com/explore/RubyC...
■ Vlog camera: Sony RX100 VII https://amzn.to/3qQfvMc
■ Other vlog cameras and gear: https://rubycarrion.com/vlogcamerasan...
■ Shop through my links to support the channel: https://rubycarrion.com/shop-my-links/
■ Get a 30 day FREE Trial of Epidemic Sound: https://www.epidemicsound.com/referra...
■ Join Rakuten for FREE and get $30 when you spend $30: https://www.rakuten.com/r/RUBYRA132?e...

DISCLAIMER: Some of the links shared in the description are affiliate links. As a member of these affiliate programs, I earn a small commission from your purchases at no additional cost to you. I appreciate your support! 💖

Комментарии

Информация по комментариям в разработке