Question

I want to read a huge data file (csv format) containing rows and columns. I want to read and process individual columns in order. Which method is more efficient in terms of speed and memory utilization? Shall I use CSVReader or Random Access File feature of Java? Please help. Thanks

Was it helpful?

Solution

If performance and efficiency are your utmost concern, use memory mapped files and NIO and write your own CSV parser.

But most often, this is just a waste of your time. So I suggest that you first try CSVReader and only if you find out that this doesn't work for you, you write your own CSV parser.

Also note that a BufferedReader will usually be faster than RandomAccessFile.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top