Answer the question
In order to leave comments, you need to log in
Parsing a whole string for different attributes (performance)?
Since I switched from .NET to Java (for work), I'm not quite familiar with effective methods for working with text. The bottom line is that the data is very huge, the reading comes from 5 huge files that are passed to the function in whole lines. Let it be String data;
This type: String data = "H 534624325 [3] 4234 32.5"
etc., as you can see, everything is separated by a simple space. First comes string, int, string,
double all this must be passed to the function someFunction(string, int, string, double) in a broken state.
I remind you: Data flows in tens of gigabytes. What is the best thing for me to look for in this situation? Tell me the appropriate functions, how to work more efficiently with such things, taking into account the slightest errors in performance? Articles are also welcome. Thanks in advance :)
upd: I stumbled on StringTokenizer while searching Google, but again I'm afraid that constant initialization of 5-10 attributes and passing them to another function will not be effective enough.
Answer the question
In order to leave comments, you need to log in
Try using Google Guava Splitter .
PS To be honest, it seems that you are doing premature optimization. Usually they write the simplest / fastest / obvious option and check how it works under load, and only then, if necessary, they begin to improve it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question