Using the java language I read text files that contain numbers. There are terabytes of data and hundreds of billions of numbers.
The goal is to fetch the data as fast as possible, and minimize GC activity. I want to parse text directly into primitives (double, float, int).
By directly I mean:
- without instantiating any transient helper object
- without boxing data in java.lang.Double, java.lang.Float...
- without creating transient java.lang.String instances (a mandatory step if you are to call JDK Double.parseDouble(...))
So far I have been using the javolution framework:
double javolution.text.TypeFormat.parseDouble(CharSequence sequence);
I looked at the javolution code and it truly does not allocate any transient object. And because it accepts a CharSequence, you can present the characters decoded from the data files without instantiating transient Strings.
Are there alternatives or better ways?