Re:Don't MAWK AWK - the fastest and most elegant big data mu...
by henning on Thursday September 10, 2009 @01:17PM
(#815679)
A pretty good showing from Java on this, even though Java's I/O system is pretty annoying. I don't think the implementation he shows there is too odious if you're used to Javaland pain.
[ Parent
| on HN ]
Re:Don't MAWK AWK - the fastest and most elegant big data mu...
by fizx on Thursday September 10, 2009 @02:04PM
(#815801)
It's not the end of the world. It just adds a few lines, but for multi-GB text processing, the runtime speedup, and the decent concurrency support is worth it.
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Foo {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String line;
while ((line = reader.readLine()) != null) {
}
}
}
Re:Don't MAWK AWK - the fastest and most elegant big data mu...
by ZitchDog on Thursday September 10, 2009 @05:30PM
(#816244)
It's not hard to write a utility that wraps an InputStream in an Iterator so you can do things like:
for(String line : readLines(System.in)) {
//do something with line here
}
Re:Don't MAWK AWK - the fastest and most elegant big data mu...
by fizx on Thursday September 10, 2009 @05:35PM
(#816254)
Like org.apache.commons.io.IOUtils.lineIterator? Ultimately, I choose to either be a Maven project and require half the world, or just a single file that's easily compiled.
If it's the latter, I don't bother creating many abstractions.