- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Why is Java slower than C++ programs?
Modern Java is quite fast and is comparable to C++ code base but it still takes lot of memory. Slowness of Java programs is primarily because of bad programming practices. But following areas are where Java can be improved.
- Java libraries are written keeping readability and correctness in mind, not performance.
- Slow String based operations as Strings are UTF-16 encoded objects and are immutable. So more String are used, more memory is required.
- Boundary checks on arrays also make its operations bit slow.
- I/O Stream operations are slow considering synchronization checks on each access.
- Lacking low level functionality like C also attributes to slowness in some cases.
- Most of the servers are tied to older version of Java causing the slowness.
Advertisements