optimized ev_buffer2.py