Fixed #22867 Pickling models is slow in alpha versions