Hacker News new | ask | show | jobs
by kuschku 2524 days ago
I’m parsing much larger datasets than those on android, in less than 18M RAM usage.

You just have to use NIO and use direct buffers instead of naively reading and allocating strings.

1 comments

So what's the point of using Java then? Of course I can do it in a non GC language using a buffer that holds one line and as much memory as needed for the data I want to retain...
Not having to worry about memory for 99% of the time.

Having to do research to optimize I/O is not just a java thing. As stated before in this thread, the C stdlib isn't historically great either, and a lot of languages piggyback on that.

Modern I/O is almost always a different library and you need to do reasearch.

Direct Buffers are a Java API to directly use C buffers and access them in a fast way. They're the fastest way to handle memory in Java.