What to learn to boost Golang code excution and performance?

I come from Python/JavaScript so I really don’t have any idea about how should I make code run faster besides writing less.
I really get confused when I hear YouTuber saying something like “C compiled 3 run faster than C compiled 1” (or something like that)
Now I started to get into my first static language, Go, I got introduced to a few things that can make my code run faster than my normal Python as using uint8 instead of uint when I’m declaring a human age for example (as age will be <0 <120)
But I can assume that there are many many other things that could make my Go code run much faster, or even as fast as Java or C++ as some here say.
I would really appreciate if someone could just list them out and I will spend my time googling for them, thanks so much

I don’t think I should ask in the same question but… can Golang run faster than the very fast languages like C++ or Java or it can only run faster than Python/ JS/ Ruby, etc…

I’d say, don’t worry about specific tricks for making things faster. Instead, learn how to use the excellent profiling tools Go has. You’ll then be solving actual problems which will give you much better payback.

To take the example of the uint8 - if you asked me to guess, I’d say it is probably slower than an int because modern CPUs aren’t optimised for byte arithmetic.

1 Like

Thanks so much!

1 Like