@@ -90,6 +90,7 @@ We run the full Mercurial test harness on Linux on a Ryzen 3950X CPU using the
9090following variants:
9191
9292* ``hg `` script with a ``#!/path/to/python3.7 `` line (traditional)
93+ * ``hg `` PyOxidizer executable using Python's standard filesystem import (oxidized)
9394* ``hg `` PyOxidizer executable using *filesystem-relative * resource loading (filesystem)
9495* ``hg `` PyOxidizer executable using *in-memory * resource loading (in-memory)
9596
@@ -100,15 +101,38 @@ The results are quite clear:
100101+=============+==============+===========+========+
101102| traditional | 11,287 | 0 | 100 |
102103+-------------+--------------+-----------+--------+
104+ | oxidized | 10,735 | -552 | 95.1 |
105+ +-------------+--------------+-----------+--------+
103106| filesystem | 10,186 | -1,101 | 90.2 |
104107+-------------+--------------+-----------+--------+
105108| in-memory | 9,883 | -1,404 | 87.6 |
106109+-------------+--------------+-----------+--------+
107110
108- PyOxidizer's custom importer with a full index of available resources
109- that is still going to the filesystem is utilizing ~90% of the resources
110- of a traditional Python process. And moving the resource data to memory
111- makes PyOxidizer binaries faster yet.
111+ These results help us isolate specific areas of speedups:
112+
113+ * *oxidized * over *traditional * is a rough proxy for the benefits of
114+ ``python -S `` over ``python ``. Although there are other factors at
115+ play that may be influencing the numbers.
116+ * *filesystem * over *oxidized * isolates the benefits of using PyOxidizer's
117+ importer instead of Python's default importer. The performance wins here
118+ are due to a) avoiding excessive I/O system calls to locate the paths
119+ to resources and b) functionality being implemented in Rust instead
120+ of Python.
121+ * *in-memory * over *filesystem * isolates the benefits of avoiding
122+ explicit filesystem I/O to load Python resources. The Rust code
123+ backing these 2 variants is very similar. The only meaningful
124+ difference is that *in-memory * constructs a Python object from
125+ a memory address and *filesystem * must open and read a file using
126+ standard OS mechanisms before doing so.
127+
128+ From this data, one could draw a few conclusions:
129+
130+ * Processing of the ``site `` module during Python interpreter
131+ initialization can add substantial overhead.
132+ * Maintaining an index of Python resources such that you can avoid
133+ discovery via filesystem I/O provides a meaningful speedup.
134+ * Loading Python resources from an in-memory data structure is
135+ faster than incurring explicit filesystem I/O to do so.
112136
113137Ignoring ``site ``
114138=================
0 commit comments