Where Java and .NET Apps Are Spending Time
Stories Columns Opinions Resources
Preflight builds spread wings for smoother projects
Developers are increasingly turning to preflight builds, allowing them to experiment with ...
|
Coverity creates program to enforce code adherence
The Architecture Analyzer uses mapping technology from the company's Software DNA static a...
|
QCon 2008 features domain-driven development
This year's QCon invites speakers like Eric Evans and Dan North to talk about domain-drive...
|
.NET similarities prove golden for Silverlight
Microsoft has focused on making Silverlight 2 symmetric with the .NET platform, and that h...
|
SOA Watch: New economic realities
In the current economic downturn, agile programming and SOA are attractive options that bu...
|
Integration Watch: A new twist on threads
The key to raising the efficiency of multiprocessors is to shrink the overall workload by ...
|
Integration Watch: The Return of NetRexx?
Java scripting languages are seeing a surge in popularity, with NetRexx looking particular...
|
Windows & .NET Watch: Transaction crowd gets a boost
With multicore chips becoming the standard for processors, the need for a flexible, usable...
|
From the Editors: Election should shake up JCP
Rod Johnson has the right ideas for opening up the Java Community Process, and he may be a...
|
Letters to the Editor: Sun gives REST, SOAP choice
A reader takes issue with a headline on our story about Sun working with REST along with S...
|
Guest View: Be smart and lazy
The optimal solution for problems is the simplest one, so always aim to streamline your ap...
|
Zeichick's Take: From EXEC to EXEC 2 to REXX to NetRexx
Andrew Binstock's column last week, "The Return of NetRexx," brought back some fond memori...
|
Advanced Corda CenterView™ Data Visualization for the BusinessObjects™ Intelligence Platform
Corda Technologies presents a white paper on pervasive BI. The BusinessObjects business in...
|
From Mobile to SOA: A Guide for Optimized Application Deployment
Customer need has driven the emergence of multiple computing tiers. Today’s application d...
|
e-Kit: Web Application Security
Is your network secure? What about your web applications.
If IT security is your top p...
|
Practical tips for saving money on code maintenance
If software design is expensive, well, code maintenance is even more so. When you look...
|
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