class Person:

    def __init__(self, name, age):
        self.name = name
self.age = age
people = [Person('Alex', 20), Person('Barbara', 25), Person('Charles', 30),
    Person('David', 35), Person('Emily', 40)]
for i in range(10000):
    output = pickle.dumps(people, -1)
if i == 0:
    print(len(output))
start_time = time.time()
for i in range(10000):
    output = pickle.dumps(people, -1)
print(time.time() - start_time)
Простая, беспроблемная сериализация без шаблонов в Scala/Java, похожая на Python Pickle?