On Sat, Jan 18, 2020 at 03:35:29PM -0500, James Cassell wrote:
On Thu, Jan 16, 2020, at 5:16 AM, Zbigniew Jędrzejewski-Szmek wrote:
>
> A quick benchmark:
> $ time python3 -c 'import importlib as i, pydoc_data.topics as t;
> [i.reload(t) for _ in range(10000)]'
> python3 -c 4.16s user 0.45s system 99% cpu 4.646 total
[...]
> sudo rm /usr/lib64/python3.7/pydoc_data/__pycache__/topics.cpython-37.*
>
> $ time python3 -c 'import importlib as i, pydoc_data.topics as t;
> [i.reload(t) for _ in range(1000)]'
> python3 -c 13.73s user 0.46s system 96% cpu 14.728 total
[...]
> But the effect of having *some* .pyc file is not. For this file (which
> is 600+kb), the difference is 147.28/4.646 ≈ 30 times. So we clearly
> need to keep the possibility of installing .pyc files, at least optionally.
>
Thanks for doing these benchmarks! I think you misplaced a decimal in the analysis,
though; it's closer to 3 times performance difference, not 30 times. (Unless I missed
something.)
The number of loops is different (10k vs 1k), so the ratio I posted is
correct.
Zbyszek