optimizations: 413k ops/sec to 830k ops/sec