buffer optimization