@@ -71,3 +71,57 @@ Development
7171To run the all tests run::
7272
7373 tox
74+
75+ Benchmarks
76+ ==========
77+
78+ The tested implementations:
79+
80+ They include these less complete proxy implementations:
81+
82+ * ``lazy_object_proxy.slots.Proxy ``, available as ``lazy_object_proxy.Proxy `` if the C extension is not available.
83+ * ``lazy_object_proxy.cext.Proxy ``, available as ``lazy_object_proxy.Proxy ``.
84+ * `objproxies <https://pypi.python.org/pypi/objproxies >`_ - fork of PJE's `ProxyTypes <https://pypi.python.org/pypi/ProxyTypes >`_ with Python 3 support. [1 ]_
85+ * `SimpleLazyObject <https://github.com/django/django/blob/stable/1.7.x/django/utils/functional.py#L337 >`_ from Django. [1 ]_
86+ * ``lazy_object_proxy.simple.Proxy `` - uses the non-data descriptor `trick <http://blog.ionelmc.ro/2014/11/04/an-interesting-python-descriptor-quirk/ >`_. [1 ]_
87+
88+ For Python 2.7::
89+
90+ --- benchmark: 5 tests, min 5 rounds (of min 25.00us), 5.00s max time, timer: time.clock ---
91+ Name (time in ns) Min Max Mean StdDev Rounds Iterations
92+ --------------------------------------------------------------------------------------------
93+ test_perf[slots] 705.3837 3091.0072 720.4805 27.2588 180453 38
94+ test_perf[cext] 93.6346 278.9731 95.1876 2.5474 164373 312
95+ test_perf[simple] 398.1636 1863.2017 405.4325 13.1411 207521 59
96+ test_perf[django] 471.6515 983.0809 480.4264 10.2059 193043 53
97+ test_perf[objproxies] 1204.7003 4818.8010 1475.3419 114.8213 55898 1
98+ --------------------------------------------------------------------------------------------
99+
100+ For Python 3.4::
101+
102+ --- benchmark: 5 tests, min 5 rounds (of min 25.00us), 5.00s max time, timer: time.perf_counter ---
103+ Name (time in ns) Min Max Mean StdDev Rounds Iterations
104+ ---------------------------------------------------------------------------------------------------
105+ test_perf[slots] 803.1335 2728.8286 826.0882 20.5562 182436 33
106+ test_perf[cext] 103.2911 254.4223 104.6869 2.6294 164373 277
107+ test_perf[simple] 448.6894 2040.6147 462.0342 17.1546 218443 49
108+ test_perf[django] 518.3013 1225.7125 532.0523 14.4672 218443 43
109+ test_perf[objproxies] 1116.8575 3827.4331 1157.8419 43.9602 174755 24
110+ ---------------------------------------------------------------------------------------------------
111+
112+ For PyPy 2.4:
113+
114+ Note that the mean difference between ``simple ``, ``django `` and ``objproxies `` is smaller the standard deviance, thus it cannot be considered.
115+
116+ ::
117+
118+ --- benchmark: 4 tests, min 5 rounds (of min 25.00us), 15.00s max time, timer: time.clock ---
119+ Name (time in ns) Min Max Mean StdDev Rounds Iterations
120+ ---------------------------------------------------------------------------------------------
121+ test_perf[slots] 1.9577 260.2979 2.2457 0.4882 498050 15384
122+ test_perf[simple] 31.3536 4374.4246 34.7433 11.7566 478894 999
123+ test_perf[django] 32.5269 4443.8381 35.8729 16.9071 461157 1000
124+ test_perf[objproxies] 33.1293 4529.3718 36.7435 13.3377 452773 1000
125+ ---------------------------------------------------------------------------------------------
126+
127+ .. [1 ] Lacks support for certain more tricky operations like ``vars(obj) `` and other operators.
0 commit comments