Make nqp::encode take a buffer, not create it.