Analysis of `crypto_pyaes` benchmark.

NOTE:For system specs see here

Comparison b/w py2 and py3 on crypto_pyaes:

Obtained using perf module i.e. perf module([here](

  • py2 -> 158 ms +- 1 ms
  • py3 -> 199 ms +- 2 ms: 1.26x slower (+26%)

About the benchmark:

This benchmark is based on pyaes modules and uses the CTR mode of operation.


Following might be the reasons for regression: (NOTE: Here both py2 and py3 are using the same pyaes module.)

  1. Import time:
    • Here too, import-time is majorly responsible for regression.Analysis of imports(obtained using -v flag here) supports this fact.These modules specifically are extra(as compared to py2):
  • weakref(Also/Hence weakrefset)
  • builtins
  • _imp (for imports_)
  • codecs
  • encodings(NOTE: the pyaes module onlyuses byte-strings)
  • reprlib
  • enum
  • selectors
  • tokenize
  • bisect(_bisect)
  • _compression
  1. Py2 uses StringIO(cString) whereas py3 use io text wrapper.Hence slow.

Here are opcodes and cProfiles.

But as with the sqlite_synth benchmark they are almost same and do not provide any extra insights

Written on July 18, 2017