g2: add optimization

Signed-off-by: houst0nn <houstonn@gmail.com>