What's the best way to create a Mandelbrot fractal in Go? pprof is not enough to help us with this ... let's learn how to use the Go tracer instead! blog post: / using-the-go-execution... code: github.com/cam...
I watched this again and it was super helpful. I wish there were more of these. I also find it funny how you get excited about performance improvements as if you've just discovered them for the first time.
You can also tell it's working better with createRow because time said that CPU was over 600% (theoretical max was 800%). Also, beginners needed a better description of why none of your (working) programs had data races. There are two cardinal sins when using goroutines: 1. communicating by sharing (unless you know why it's safe) and 2. not knowing when your goroutines exit (thanks Uncle Dave). You did a great job of showing that even in toy programs your goroutines have to exit correctly.
I've been needing to understand profiling in go for a while. I've never really grok'ed it properly before but you've made it so super simple. Thank you ❤️
I actually enjoy the go tooling because from every video I have seen and tutorials I followed on benchmarking performance, after watching your video I finally get it. Thanks.
Very interesting. I will immediately apply it to one of my first apps that is extremely CPU intensive and I did use the "let's create millions of routines and let Go handle it" approach.
This is helpful, but I need to mention how challenging this is when you have a real program. It’s much harder “in the wild”. Having unit tests to ensure that your optimization did not break anything is recommended over manual inspection.
I'd like to know more about how to do optimizations in Go such as avoiding cache misses and aligning (slices/arrays of) data in memory. Also, and probably more importantly, how to reduce allocations and garbage collection.
This video gives me a good feeling that using the worker pools is most of the time the right pattern I use! The video was awesome! Keep these coming, because I feel like a lot of stdlib things aren't very well documented, explained or advertised. One question I have for long running programs: Can you create traces while running e.g. in a container, like it's possible with pprof via http? Thanks! :)
Thank you Francesc! Some of patterns you've showed, have well established names, so it would be nice if you'll refer to "official" name where appropriate. For example, last pattern you've used is called bounded parallelism, as far as I know. PS: nice caveat561 gotcha :)
This somehow shows that blocking send/receive on a channel(2048 times) has more overhead than the scheduler scheduling 2048 goroutines on 8 cores. Since there are only 8 goroutines in the first case and the process is CPU heavy, so I don't expect any of the 8 goroutines getting scheduled on/off from the CPU. Please feel welcome to critique this hypothesis.
yeah, runtime.NumCPU() but to find the optimal number of worker routines how to proceed ? somewhere in irc channel i heard someone saying dont use numcpu
Alexander Svensson because he was trying to time the performance of the thing. Some of the time spent in go run is compiling stuff, so it adds overhead to each test.
go channels have some overhead and can get a bit slower than a simple mutex, github.com/golang/go/wiki/MutexOrChannel A discussion on the topic: news.ycombinator.com/item?id=11210578 (I disagree that channels are bad)