products:ict:go_golang
Differences
This shows you the differences between two versions of the page.
products:ict:go_golang [2022/05/13 00:45] – created - external edit 127.0.0.1 | products:ict:go_golang [2024/05/04 18:55] (current) – wikiadmin | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | the Go programming language and its compiler. | ||
+ | |||
+ | 1. **Designed for Concurrency and Performance: | ||
+ | - Go (also known as Golang) was created by Google engineers who were frustrated with their existing toolset while waiting for other programs to compile. They decided to rethink system programming from the ground up. | ||
+ | - The result was a lean, mean, and compiled solution that excels in areas like massive multithreading, | ||
+ | - Running Go on modern hardware, including inside containers or on virtual machines, is a pleasure. It is designed to run on multiple cores and scales well as more cores are added¹. | ||
+ | |||
+ | 2. **Goroutines and Concurrency: | ||
+ | - One of Go's standout features is goroutines. These are essentially concurrent functions that run alongside the main program. | ||
+ | - You can fire off a goroutine, have it run independently, | ||
+ | - For example, if a network timeout occurs, a goroutine can manage it while the main loop continues. Even in the case of a complete database failure, your program can gracefully work around the issue. | ||
+ | - Here's a simple example of using goroutines in Go: | ||
+ | | ||
+ | |||
+ | < | ||
+ | | ||
+ | |||
+ | | ||
+ | " | ||
+ | " | ||
+ | ) | ||
+ | |||
+ | func hello() { | ||
+ | | ||
+ | } | ||
+ | |||
+ | func main() { | ||
+ | go hello() | ||
+ | | ||
+ | | ||
+ | } | ||
+ | </ | ||
+ | The `hello()` function runs concurrently with the main program, demonstrating the power of goroutines¹. | ||
+ | |||
+ | 3. **Speed and Efficiency: | ||
+ | - Go's compiler is blazing fast. In a regex test, Go outperformed Java significantly. For the same task, Go ran in 3.55 seconds, while Java took 5.58 seconds. | ||
+ | - Although Go's code may be slightly heftier than Java' | ||
+ | |||
+ | 4. **Safety and Adaptability: | ||
+ | - Go aims to combine the ease of programming of an interpreted, | ||
+ | - It is well-adapted to current hardware, supporting networked and multicore computing³. | ||
+ | |||
+ | In summary, Go's reliability lies in its simplicity, powerful concurrency model, and efficient compilation process. Whether you're building web apps, system utilities, or microservices, | ||
+ | |||
+ | Source: Conversation with Bing, 5/4/2024 | ||
+ | (1) What's so great about Go? - Stack Overflow. https:// | ||
+ | (2) Frequently Asked Questions (FAQ) - The Go Programming Language. https:// | ||
+ | (3) The Reliability of Go | Hacker News. https:// | ||
+ | (4) Understanding Go Compiler. Go is a High-Level Language, Binary… | by .... https:// | ||
+ | (5) What language is the compiler of Go programming language written in?. https:// | ||
+ | (6) github.com. https:// | ||
+ | |||
+ | |||
products/ict/go_golang.1652384725.txt.gz · Last modified: 2022/05/13 00:45 by 127.0.0.1