Why is the difference between stack and the efficiency of the derived stack higher than stack?

Source: Internet
Author: User

Both stacks and stacks are places where Java is used to store data in Ram.


The stack mainly stores some basic types of variables (INT, short, long, byte, float, double, Boolean, char ). Data in the stack can be shared. The advantage of stack is that the access speed is faster than that of stack, second only to register, and stack data can be shared. However, the disadvantage is that the data size and lifetime in the stack must be fixed, and there is a lack of flexibility.


A heap is a runtime data zone and class (the object allocates space from it. Because the memory needs to be dynamically allocated at runtime, the access speed is slow. Data in the stack can be shared.


Stack is allocated space during compilation, while stack is dynamically allocated (space allocated during runtime), so the stack speed is fast.
The CPU has a dedicated register (ESP, EBP) to operate the stack. The stack uses indirect addressing. Stack faster.

Why is the difference between stack and the efficiency of the derived stack higher than stack?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.