input stream optimization