Go's performance is not as good as Java's?
I saw a question on Zhihu today about the performance comparison between <span style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">Go</span>
and <span style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">Java</span>
. This kind of question There is usually only one ending, and that is endless debate. Ten years from now, if these two languages are still alive, this may still be a hot issue:
Put aside the application Talking about performance in scenarios is just a joke
At present, I mainly use Java and Go, and the direction is big data. First, let me talk about my views:
Most languages have areas in which they are good at, and their existence is reasonable:
<span style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;line-height: 22px;font-size: 15px;">PHP</span>
Good at Building low-cost WEB is also the best language in the world<span style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;line-height: 22px;font-size: 15px;">c</span>
Good at operating systems and embedded<span style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;line-height: 22px;font-size: 15px;">Go</span>
Naturally high concurrency attribute##R<span style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;line-height: 22px;font-size: 15px;"></span>
’s scientific calculations and statistics are unparalleled<span style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;line-height: 22px;font-size: 15px;">Python</span>
is the leader in the field of AI<span style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;line-height: 22px;font-size: 15px;"> Java</span>
Industrial-grade application services and Android (the old gangster who has long dominated the TIOBE list)##Benchmarks<span style="color: rgb(74, 74, 74);box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;line-height: 22px;"></span> The test data can certainly explain some problems, but this test environment and method are still not grounded enough. It is rare to encounter similar cases, and it will not be mentioned in actual use. Because of the gap of a few milliseconds, I changed the language and refactored the project.
## Hot Code
<span style="color: rgb(74, 74, 74);font-size: 16px;box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;line-height: 22px;"> This concept is very important. Some code snippets will hit once a month, then it will not How much extreme optimization is needed. </span>
28
<span style="color: rgb(74, 74, 74);font-size: 16px;box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;line-height: 22px;"> Rule, spend 80% of your energy on the important 20% of the code, people My energy is limited, and there are still many beautiful things in the world, such as writing original articles to share with everyone (manual wink). </span>
-
##Talkischeap.Showme the code.
Summary of advantages and disadvantagesBased on my experience, the current programming level of most people , it’s not my turn to talk about the performance of the language itself. If you are not, then please add me on WeChat and let me fly. <span style="color: rgb(74, 74, 74);font-size: 16px;box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;line-height: 22px;"></span>
The current problem with JAVA is not performance, because the code automatically optimized by JIT is already comparable to C.
The problem with JAVA is that in real actual projects, there are too many third-party dependencies, a bloated architecture, and over-design. At this time, it is hard to say who will win.
I personally think that because go basically only needs the standard library, the performance in actual projects is better than JAVA (Go’s coroutine is essentially an asynchronous IO model, Go language: everything is asynchronous ), in addition, resource usage is also a part of performance. Obviously go has smaller memory usage and relatively low CPU consumption.
Go on the benchmark game runs faster than Java in most scenarios, and the memory consumption is 1/3 of Java;
Let’s list the shortcomings of Go:
It’s a bit anti-programmer syntax
No generics
The data structures in the standard library are far less rich than Java
Dependency management is useless
If channel is used improperly, it is very easy to deadlock
Loop import is not allowed during compilation
Many package names will conflict with custom variable names during coding
There are many libraries that we take for granted in Java, but we find that we have to reinvent the wheel in Go
The go get command will clone the entire git Warehouse, including historical commit
The standard library does not provide a routine pool
There is no ready-made one Future mechanism, you have to implement it yourself through channel
Those are the things that come to mind for the time being; of course all of these can be solved
Disadvantages of Java:
Those are the things that come to mind for the time being; of course, the advantages of Java far outweigh these shortcomings, otherwise it would not be ranked first in the TIOBE programming language rankings all year round
Lack of language expression skills (a down-to-earth term is "stinky and long")
High memory and CPU consumption
When the heap memory is large, the garbage collector needs in-depth tuning to obtain satisfactory recycling effects; however, in some cases In scenarios with high real-time requirements, gc may simply have no solution. Once full gc is triggered, it will be hell
The program needs to be warmed up
The JDK is huge, and the springboot jar package is huge (the problem is most prominent under the microservice architecture)
##Spring FamilyBucket is getting heavier and heavier (for Spring, it is enough for you to do IoC AOP), resulting in poor performance of applications using FamilyBucket (please refer to the position of spring in TechEmpower Round 14), but it is still sufficient
Because there are too many mature frameworks and libraries, many people are biased when they get started, thinking that programming is just adjusting APIs and using frameworks, but they know little about the principles
The above is the detailed content of Go's performance is not as good as Java's?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Guide to Perfect Number in Java. Here we discuss the Definition, How to check Perfect number in Java?, examples with code implementation.

Guide to Weka in Java. Here we discuss the Introduction, how to use weka java, the type of platform, and advantages with examples.

Guide to Smith Number in Java. Here we discuss the Definition, How to check smith number in Java? example with code implementation.

In this article, we have kept the most asked Java Spring Interview Questions with their detailed answers. So that you can crack the interview.

Java 8 introduces the Stream API, providing a powerful and expressive way to process data collections. However, a common question when using Stream is: How to break or return from a forEach operation? Traditional loops allow for early interruption or return, but Stream's forEach method does not directly support this method. This article will explain the reasons and explore alternative methods for implementing premature termination in Stream processing systems. Further reading: Java Stream API improvements Understand Stream forEach The forEach method is a terminal operation that performs one operation on each element in the Stream. Its design intention is

Guide to TimeStamp to Date in Java. Here we also discuss the introduction and how to convert timestamp to date in java along with examples.

Capsules are three-dimensional geometric figures, composed of a cylinder and a hemisphere at both ends. The volume of the capsule can be calculated by adding the volume of the cylinder and the volume of the hemisphere at both ends. This tutorial will discuss how to calculate the volume of a given capsule in Java using different methods. Capsule volume formula The formula for capsule volume is as follows: Capsule volume = Cylindrical volume Volume Two hemisphere volume in, r: The radius of the hemisphere. h: The height of the cylinder (excluding the hemisphere). Example 1 enter Radius = 5 units Height = 10 units Output Volume = 1570.8 cubic units explain Calculate volume using formula: Volume = π × r2 × h (4

Java is a popular programming language that can be learned by both beginners and experienced developers. This tutorial starts with basic concepts and progresses through advanced topics. After installing the Java Development Kit, you can practice programming by creating a simple "Hello, World!" program. After you understand the code, use the command prompt to compile and run the program, and "Hello, World!" will be output on the console. Learning Java starts your programming journey, and as your mastery deepens, you can create more complex applications.
