Go vs Php 8 Performance
Compiled language vs Scripting language ๐
Compiled code is faster than scripts with order of magnitude. Even after using a Just-in-time (JIT) compiler for PHP 7.4 and PHP 8 , PHP still slower than Go. Go is a clear winner.
Concurrency ๐
Go has concurrency as a built-in first class citizen. But PHP is good old language with no concurrency or parallelism in mind. The parallelism is achieved by executing scripts as a different process. PHP is not bad, but Go is the great treasure in concurrency. Go is a clear winner here.
Memory Usage ๐
Go uses less memory than PHP. Go is a clear winner here.
What to choose ? ๐
If you are free to use the language or framework for the project and nothing is forcing you to choose a specific language and/or framework, I recommend choosing Go programming language.
But if you are using shared hosting, choose PHP / Laravel. It is supported easily.
If you are improving a ready project, just use whatever tech stack developers chose to develop that project with.
If your current project is not written in Go, and it needs huge refactoring, try to use Go and build a clean project from scratch. But make sure it fits the job and team of developers you work with.
Either create the new project as a side project and develop it until it matures then replace the old project with the mature Go project.
Or develop a minor service or part in the project in Go, then try to migrate parts of the project into Go. Until almost all parts are migrated into Go programming language, then refactor the rest parts / glue into Go. And voila .. the project is now written in Go.