[PATCH] Read and sort events in chunks from stdin