SDA India is an online resource for Software, Development,IT, Architecture, Open Source, Mobile, Security, Databases, Delphi, C, OS, Asp, .Net, Php, Xml, Java

Average Rating Rate this article Poor Below Average Average Good Excellent
1 2 3 4 5
Coolest Features


Java Performance Myths- Separating Wheat From The Chaff



Google engineers Jeremy Manson and Paul Tyma have reached to a conclusion in an article that most of the things we think we know about Java performance are actually pretty hard to quantify and according to them it is nothing but “an unending search for the truth.”

Manson and Tyma shared their insights with SD West attendees, at Spring’s Software Development West, on the assumptions that developers make while writing a code.

Manson opined that “we had been writing a lot of code such as fast code, server code, C++ code, Java code and we realized that there are a lot of myths regarding Java performance, beliefs that we just knew were not true, but had never tested.”

The common assumptions that developers make while writing a code are versions don’t matter, 64-bit code is slower than 32-bit code, thread context switching is expensive, and locking is expensive.

Putting an end to all these assumptions, Tyma further described that number of people think that they can keep on using 1.4 forever, and it won’t affect performance. But it is not the case, it turns out they have been improving Java steadily over the past 13 years, and 1.6 is a lot faster than 1.5, and 1.5 is a lot faster than 1.4. The truth is 1.4 byte code can run on 1.6 VMs.

According to Manson, the reason for those who think 64-bit code is slower than 32-bit code is that they believe the pointers are twice as large, and all of a sudden they are taking up between one and two megs of memory, and now that they are using more memory, the code is not going to fit into the L1 and L2 cache, which will slow down the code. But Manson added that this scenario does not always manifest in the x86 world, because 64-bit code has twice as many registers, so there is less register spillage, and one can have longer pipelines in processor. So code that is very intensive in terms of registers and integer performance can be a lot faster in 64-bit.

While testing the Linux 2.6 NPTL library, it is observed that context switching was not expensive at all. Even with a thousand threads competing for Core Duo CPU cycles, the context switching was not even noticeable.

Tyma noted that contended synchronization does cost more, but doesn’t tend to scale. Uncontended synchronization is cheap, and can even be free. Add a thread, and that picture changes. Synchronized locking with contention gets more expensive. The cost goes up significantly. But increase the number of threads, and the cost doesn’t change much after that.
“Don’t avoid synchronization. When doing tricky things to avoid synchronization, you end up writing really bad code,” said Manson.

Those developers, who are seeking to write faster Java code, don’t waste your time trying to take advantage of any of these kinds of performance myths. Just write the best code and profile it to find the bottlenecks, remove the bottlenecks, rinse and repeat, and there you are on your way to write faster Java code.


   Related Links
  Source
Post a Comment
Name
Title
Comment
From the News Desk
Articles

Enterprises today are heterogeneous in nature comprising of legacy and modern systems. To remain competitive integration of applications within a business or between different businesses must be done quickly and cost effectively. However it is a complex task requiring diverse, heterogeneous applications, developed in different architectures and programming languages …

Your proof of concept is complete. You’re confident a service-oriented architecture (SOA) approach will make your IT department more responsive to business needs and better able to deliver positive business outcomes. But how do you start?Because of the inherent complexity and broad impact of an SOA implementation, a centralized …

SOA is hot and being an expert in SOA can be a ramp up for a successful career in the international IT market. But what do companies expect from a SOA expert? Are special skills needed which differ from general IT skills? How important is process and industry experience to be …
Interviews

SOA is a principle of creating software functions as services, to enable alignment of business processes and related IT assets to meet change in business needs, leading to business agility, reduction in time to IT and cost to IT. SDA-India.com in conversation with Mr. K.R.Sanjiv on how does Service Oriented Architecture contribute to business …

Agile is a set of principles and practices for how to develop software and Scrum is a management methodology for implementing agile principles. SDA-India.com in conversation with Mr. John Scumniotales, VP of ALM Products, Serena Software. …

We are currently in the process of developing an Enterprise Information Management suite that would enable efficient management of both the structured and unstructured data of large organizations and provide a personalized digital dashboard to all the stakeholders to view critical reports and important documents. SDA-India.com in conversation with Mr Shastri, Chairman and Managing …
RSS
more »                                   
Menu
News Desk
Feature Stories
Articles
Interviews
Case Studies
White Paper
Analyst Corner
Planet SDA-India
SDA Events
INDIA IT Event Calender
IT Jobs
Advertise