CHANNELS
 
 
 
 
 
 
 
 
ON THE WEB
 
 
 
 
PRINT EDITION
 
 
 
 
BZ MEDIA
 
 
 
 
ADVERTISER LINKS
 
 
 
 
 
 
 
AS OF 11/21/2008 12:41PM EST
Where Java and .NET Apps Are Spending Time
Stories Columns Opinions Resources

By Edward J. Correia

May 13, 2008 —  As a tester of Java and/or .NET applications, do you know where those programs are spending time? If your apps deal with XML, HTML or another text-based protocol, they’re likely bogged down with text-to-number conversions. And if you’re using standard libraries to perform those conversions, you might do better to look elsewhere.

Java and .NET both provide APIs that format primitive types as strings and vice versa. Both can specify formats including decimal, fixed-point and scientific types, though syntax varies. But they perform those conversions relatively slowly, according to Eyal Alaluf, who claims his algorithms do it better. And he can prove it. And the good news? They’re free.

Alaluf, a 15-year developer, is vice president of technology at Mainsoft, which late last year performance-tested string-to-integers and number-to-string conversion rates of Java and .NET APIs. Mainsoft develops software portability tools for Linux, Unix and Windows apps. For a description of the test bed system, read the full report.

The test results start out by showing the relative conversation strengths and weaknesses of each language. For example, while Java (SE 6.0) outperformed .NET by about three-to-one with integer conversions, .NET outran Java by about 10-to-one with large and small doubles. Microsoft’s algorithms also outperformed Java with currency and real-number conversions, but only by about two-to-one. The full report contains all the performance numbers (which it said were identical across .NET 2.0, 3.0 and 3.5).

Here’s where things get interesting. Mainsoft’s implementation of the .NET APIs outperforms Microsoft’s in every case, and with integer conversions by almost three-to-one. Mainsoft’s Java algorithm delivered a performance gain of between three and 15 times that of the default algorithms in all but the string-to-integer conversions, which “uses a specialized Java algorithm,” Alaluf said.

Following .NET semantics, the Mainsoft integer formatting algorithm uses a three-step process: it parses the format for the type and precision; the number is converted to a list of digits; that list is “converted to a string by applying the logic of the specific format and the culture-specific information,” Alaluf explained in the report.

“We improve the conversion performance by formatting digits representation using bitwise operations, which CPU registers are optimized to use,” reported Alaluf, a process he said is faster than array traversals and is further aided by using thread-specific storage to boost performance by minimizing memory allocations.

The company’s formatting algorithm for real numbers for Java and .NET follows the IEEE 754 standard for floating point arithmetic. It “converts a double precision floating point into a 64-bit integer and power of ten” using an O(1) conversion. It then applies the integer formatting algorithm to the 64-bit integer and figures out where to put the decimal based on the given power.

Mainsoft and Eyal Alaluf welcome questions and comments at dev.mainsoft.com about the free algorithms, which will be implemented in a future release of the Mono open-source implementation of the .NET runtime.


Share this link: http://www.sdtimes.com/link/32179
 


 
 
 
 
 
 
 
 
 
 
SUBSCRIBE TODAY!
 E-Newsletters:
  News on Mon/Thurs.  More info
  Test & QA Report  More info
  EclipseNews  
  SPTech Report  More info
 
 
 
PDF & PRINT EDITION
* Requires Resource Account!  LOGIN or SIGN UP

Download Current Issue!
ISSUE 11/15/2008 PDF

Need Back Issues?
DOWNLOAD HERE

Receive The Print Edition?
SUBSCRIBE HERE
 
REGISTER
 
GET NOTIFIED!
About all of the latest Resources
 
 
SD TIMES 100
It's time once again to
recognize the organizations
or individuals that have
demonstrated leadership in
their markets.