Nullstone Logo

COMPANY
Home
Contacts
Customers
Testimonials

PRODUCTS
Overview
NULLSTONE for C
NULLSTONE for Java
Technical Overview

SUPPORT
Release Notes
Download
PGP Information
Service Report
Write Us

INFORMATION
Performance Results
Glossary of Terms

RELATED LINKS
Compiler Connection
Compiler Jobs

Previous Up Next
New Expression Optimization

Java supports automatic garbage collection. What this means is all objects allocated using the new expression are deallocated automatically by the garbage collection. However, where an object allocated using new is never used, it is much more optimal to just remove the call to new. Java guarantees initialization of all allocated objects. By removing the call to new, in addition to the default initialization, significant gain in speed can be achieved.

Example:

In the code fragement below, the object a is not used and hence the new expression can be deleted.

    {
    	int a[];
    	a = new int[100];
    }
    

Below is the code fragment after New Expression Optimization.

    {
    	// a not used and hence not allocated/initialized
    }
    

Notes:

New Expression Optimization is a very important optimization.

Some programs may not need default initialization of objects. Detecting such cases and avoiding the default initialization will provide significant performance gain when large arrays are involved.

© 1990-2012 Nullstone Corporation. All Rights Reserved.