optimize engine kernel