[Python-Dev] Can I make marshal.dumps() slower but stabler?

Serhiy Storchaka storchaka at gmail.com
Thu Jul 12 02:21:55 EDT 2018

12.07.18 08:43, INADA Naoki пише:
> I'm working on making pyc stable, via stablizing marshal.dumps()
> https://bugs.python.org/issue34093

This is not enough for making pyc stable. The order in frozesets still 
is arbitrary.

> Sadly, it makes marshal.dumps() 40% slower.
> Luckily, this overhead is small (only 4%) for dumps(compile(source)) case.

What about the memory consumption?

> So my question is:  May I remove unstable but faster code?
> Or should I make this optional and we maintain two complex code?
> If so, should this option enabled by default or not?

My concern is that even if not make it optional, this will complicate 
the code.

> For example, xmlrpc uses marshal.  But xmlrpc has significant overhead
> other than marshaling, like dumps(compile(source)) case.  So I expect
> marshal.dumps() performance is not critical for it too.

xmlrpc doesn't use the marshal module. It uses terms marshalling and 
unmarshalling, but in different meaning.

> Is there any real application which marshal.dumps() performance is critical?
EVE Online is a well known example.

What if write a script which loads .pyc files and stabilize them? This 
could solve the problem for applications which need stable .pyc files, 
with zero impact on common use.

More information about the Python-Dev mailing list