porting bench from optimize branch