The human-readable text-serialization is one of the most expensive ways to serialize. See the comment in https://github.com/Blunde1/agtboost/issues/55#issuecomment-1187996654. Take a look at more efficient and robust ways of serialization.