@@ -207,59 +207,60 @@ Geometric Mean 6686.61 6392.17 17593.94 11127.67 6191.21 1
207
207
=============== ========== ========== ========== ============== ========== ============
208
208
209
209
210
- PyPy7.2 -Py3.6:
210
+ PyPy7.3 -Py3.6:
211
211
212
212
=============== ========== ========== ========== ============== ============
213
213
Test 1 Django peewee Pony ORM SQLAlchemy ORM Tortoise ORM
214
214
=============== ========== ========== ========== ============== ============
215
- Insert: Single 4844.65 5699.46 6069.36 928.29 4119.27
216
- Insert: Batch 6623.80 5942.15 14888.52 6750.90 19889.84
217
- Insert: Bulk 15833.01 19876.12 — 19456.28 59792.55
218
- Filter: Large 145843.64 96627.96 212065.79 110034.60 83070.61
219
- Filter: Small 4867.78 61654.60 172243.99 56155.40 40043.36
220
- Get 3538.23 7448.17 5911.03 4175.23 8464.85
221
- Filter: dict 142764.62 109864.27 131992.03 121185.63 94067.34
222
- Filter: tuple 143723.62 106352.47 206592.66 263009.74 126491.99
223
- Update: Whole 6448.56 14572.05 19806.92 23459.62 25520.65
224
- Update: Partial 7320.68 20191.26 32069.98 40098.96 36326.02
225
- Delete 8583.36 29682.59 73035.62 83364.88 37541.98
226
- Geometric Mean 15281.28 25564.53 43575.11 27864.52 33369.34
215
+ Insert: Single 4092.94 6042.45 6166.89 1004.98 6786.58
216
+ Insert: Batch 4529.93 6456.81 18247.22 6982.63 26348.64
217
+ Insert: Bulk 17961.11 24302.27 — 21428.22 80531.38
218
+ Filter: Large 152801.52 91886.54 295678.67 129700.40 90993.88
219
+ Filter: Small 6099.36 65094.77 175134.68 60966.19 45463.05
220
+ Get 4255.07 6793.41 8310.16 4339.15 9229.52
221
+ Filter: dict 147533.08 116293.38 215108.01 109211.59 94985.63
222
+ Filter: tuple 175529.83 122951.45 281181.48 253415.27 130914.54
223
+ Update: Whole 6710.01 16514.91 41939.12 22677.70 30434.61
224
+ Update: Partial 8089.69 23377.04 51308.13 43023.59 38576.48
225
+ Delete 8766.41 29169.88 74799.44 81948.65 42805.28
226
+ Geometric Mean 15887.12 27270.66 58524.96 28825.51 39281.41
227
227
=============== ========== ========== ========== ============== ============
228
228
229
229
=============== ========== ========== ========== ============== ============
230
230
Test 2 Django peewee Pony ORM SQLAlchemy ORM Tortoise ORM
231
231
=============== ========== ========== ========== ============== ============
232
- Insert: Single 4856.53 6099.71 6302.97 886.47 4709.30
233
- Insert: Batch 6388.57 5979.01 14255.97 4636.63 19616.08
234
- Insert: Bulk 15675.79 18751.54 — 17444.69 62711.06
235
- Filter: Large 130201.72 86533.17 311024.40 110243.82 69154.04
236
- Filter: Small 3845.09 65312.52 183754.86 47955.16 36348.92
237
- Get 3540.29 7934.10 9121.36 4233.04 6100.74
238
- Filter: dict 138333.47 105259.77 237840.16 119919.30 77601.55
239
- Filter: tuple 155187.72 89280.79 335520.30 260503.32 116994.87
240
- Update: Whole 6693.48 13079.63 37170.20 18749.98 22658.09
241
- Update: Partial 7609.05 17583.81 47285.79 27172.58 35797.50
242
- Delete 2339.78 36752.54 41859.66 655.36 40024.90
243
- Geometric Mean 13247.47 25048.86 55454.4 15927.71 31084.92
232
+ Insert: Single 4089.62 5982.16 5927.49 818.31 8128.96
233
+ Insert: Batch 4582.76 6909.47 15558.25 6012.19 25381.23
234
+ Insert: Bulk 16201.10 24021.67 — 20294.09 77993.66
235
+ Filter: Large 138968.39 90818.94 279382.51 118860.29 71640.16
236
+ Filter: Small 5439.62 62951.57 168192.03 52251.13 38208.34
237
+ Get 4092.11 6989.34 8230.02 3379.57 8430.82
238
+ Filter: dict 134900.00 112626.68 202932.98 94477.51 71689.52
239
+ Filter: tuple 159685.66 122797.29 274293.13 223882.76 119104.10
240
+ Update: Whole 6201.26 11396.24 35644.86 17562.70 28303.72
241
+ Update: Partial 7669.88 23086.17 41247.77 25492.40 35430.58
242
+ Delete 2087.76 34330.64 38098.81 633.66 369.97
243
+ Geometric Mean 13135.78 26719.72 50653.72 15519.07 23445.05
244
244
=============== ========== ========== ========== ============== ============
245
245
246
246
=============== ========== ========== ========== ============== ============
247
247
Test 3 Django peewee Pony ORM SQLAlchemy ORM Tortoise ORM
248
248
=============== ========== ========== ========== ============== ============
249
- Insert: Single 1965.02 3519.71 4207.43 670.29 3592.01
250
- Insert: Batch 1904.72 3493.31 7636.38 4421.69 12099.74
251
- Insert: Bulk 4054.34 7156.34 — 13786.11 24692.28
252
- Filter: Large 20301.33 29613.15 122365.02 38721.68 2855.62
253
- Filter: Small 1908.01 26244.67 105406.30 24031.37 2478.21
254
- Get 2111.95 4936.50 6633.01 2315.14 1348.12
255
- Filter: dict 28415.33 39443.07 75871.80 28089.40 2995.77
256
- Filter: tuple 26695.73 39080.83 125314.67 58677.38 10422.97
257
- Update: Whole 4072.91 5559.29 27090.75 11341.40 12903.72
258
- Update: Partial 7782.08 20601.30 37512.08 14907.51 31801.49
259
- Delete 9303.80 26078.32 59424.56 63702.66 42910.38
260
- Geometric Mean 5855.94 12832.73 33099.23 12839.01 7698.50
249
+ Insert: Single 2194.07 3827.50 4030.12 792.54 5429.88
250
+ Insert: Batch 2072.86 3928.59 7509.87 4841.25 15489.04
251
+ Insert: Bulk 4747.82 9996.01 — 15407.30 29085.53
252
+ Filter: Large 25016.73 30627.76 122459.86 37727.96 2968.21
253
+ Filter: Small 1508.74 24123.13 98162.15 21523.32 2454.28
254
+ Get 2231.56 4443.86 6313.33 2312.70 1490.23
255
+ Filter: dict 29467.52 40064.73 81433.44 27085.70 3001.12
256
+ Filter: tuple 31329.65 46774.06 123617.06 45894.78 8845.51
257
+ Update: Whole 4220.60 6984.34 29109.60 10686.28 11302.96
258
+ Update: Partial 7346.76 21125.93 33835.74 14716.48 24182.52
259
+ Delete 9083.28 31221.47 64601.85 64029.41 41709.27
260
+ Geometric Mean 6146.34 14064.74 32867.64 12702.84 7951.76
261
261
=============== ========== ========== ========== ============== ============
262
262
263
+
263
264
Results (PostgreSQL)
264
265
====================
265
266
@@ -374,6 +375,60 @@ Geometric Mean 5549.9 3979.97 12006.83 7386.97 4155.09
374
375
=============== ========== ========== ========== ============== ========== ============ ================
375
376
376
377
378
+ PyPy7.3-Py3.6:
379
+
380
+ =============== ========== ========== ========== ============== ============
381
+ Test 1 Django peewee Pony ORM SQLAlchemy ORM Tortoise ORM
382
+ =============== ========== ========== ========== ============== ============
383
+ Insert: Single 2479.55 2663.10 3088.68 686.92 3311.91
384
+ Insert: Batch 3478.12 4571.76 5194.87 4214.03 13584.52
385
+ Insert: Bulk 14553.90 19480.48 — 15260.41 55214.98
386
+ Filter: Large 80983.35 175029.85 479457.80 59215.04 160185.46
387
+ Filter: Small 4995.72 37628.16 136060.23 18990.66 24888.53
388
+ Get 2868.25 4870.54 6107.97 2630.39 6538.67
389
+ Filter: dict 80650.88 219339.95 301358.89 52242.19 183104.50
390
+ Filter: tuple 93584.59 257332.26 490594.29 74740.17 175407.06
391
+ Update: Whole 3563.43 7760.36 5348.80 5540.23 11161.77
392
+ Update: Partial 4536.02 10036.94 11210.07 12264.97 14984.03
393
+ Delete 4978.72 10073.98 11107.52 10907.25 12449.24
394
+ Geometric Mean 9889.22 20926.09 30192.66 11285.31 26393.92
395
+ =============== ========== ========== ========== ============== ============
396
+
397
+ =============== ========== ========== ========== ============== ============
398
+ Test 2 Django peewee Pony ORM SQLAlchemy ORM Tortoise ORM
399
+ =============== ========== ========== ========== ============== ============
400
+ Insert: Single 2266.32 2663.82 2669.34 597.25 3513.88
401
+ Insert: Batch 3328.18 4435.96 6949.97 3773.89 10493.08
402
+ Insert: Bulk 14065.42 18684.71 — 14458.93 55861.34
403
+ Filter: Large 80296.63 164763.64 447302.97 54498.39 153077.80
404
+ Filter: Small 4800.15 35434.65 130211.62 17627.65 21258.96
405
+ Get 2565.44 4543.19 5849.48 2310.20 6251.27
406
+ Filter: dict 77842.51 207108.12 280970.71 50958.86 185933.49
407
+ Filter: tuple 91267.58 239574.53 438762.04 73630.97 172285.95
408
+ Update: Whole 2701.75 5406.82 6975.43 4327.97 9913.26
409
+ Update: Partial 4539.54 9879.36 10746.90 10125.79 14495.50
410
+ Delete 1176.44 7017.19 6249.98 1387.88 8181.26
411
+ Geometric Mean 8165.06 18884.27 28591.56 8489.41 24079.39
412
+ =============== ========== ========== ========== ============== ============
413
+
414
+ =============== ========== ========== ========== ============== ============
415
+ Test 3 Django peewee Pony ORM SQLAlchemy ORM Tortoise ORM
416
+ =============== ========== ========== ========== ============== ============
417
+ Insert: Single 1008.08 1582.11 1617.94 465.03 2258.82
418
+ Insert: Batch 1492.21 2833.39 3595.88 2126.38 6739.82
419
+ Insert: Bulk 3357.71 6484.93 — 6410.32 16790.12
420
+ Filter: Large 12164.83 40576.68 109275.41 9531.62 34746.82
421
+ Filter: Small 2314.81 12551.29 58031.65 5503.53 9873.51
422
+ Get 1083.01 2165.71 2800.69 854.14 2358.51
423
+ Filter: dict 12742.82 54209.15 73098.84 8640.37 46526.40
424
+ Filter: tuple 13728.33 62009.01 107794.63 10255.39 42013.15
425
+ Update: Whole 1589.21 2352.14 4388.50 3946.67 5021.95
426
+ Update: Partial 3894.78 8822.50 6142.39 7243.80 14487.33
427
+ Delete 3791.23 8238.25 8413.57 8394.18 11540.60
428
+ Geometric Mean 3367.9 8574.74 13385.55 4134.8 11175.14
429
+ =============== ========== ========== ========== ============== ============
430
+
431
+
377
432
Quick analysis
378
433
--------------
379
434
* Pony ORM is heavily optimised for performance.
@@ -382,14 +437,20 @@ Quick analysis
382
437
* ``Get `` is surprisingly slow for everyone.
383
438
* Pony ORM, SQLAlchemy & SQLObject does merge operations for updates, so is technically always partial updates.
384
439
* Tortoise ORM performance using the ``asyncpg `` PostgreSQL driver is really good, winning overall.
385
- * Tortoise ORM performance using the ``aiomysql `` MySQL driver is mediocre, the driver itself is taking the majority of CPU time.
440
+ * Tortoise ORM performance using the ``aiomysql `` MySQL driver is mediocre, the driver itself is taking the majority of CPU time. PyPy runs this driver a lot faster, which indicates that the slow paths are likely just Python itself.
386
441
387
- PyPy comparison
388
- ---------------
442
+ PyPy comparison: SQLite
443
+ -----------------------
389
444
* ``peewee `` and ``Pony ORM `` gets a noticeable performance improvement
390
- * ``SQLAlchemy ORM `` is marginally faster
391
- * ``Django `` is marginally slower
392
- * ``Tortoise ORM `` is notably slower, but notably faster for Updates & Deletes
445
+ * ``SQLAlchemy ORM `` and ``Django `` performs similarily
446
+ * ``Tortoise ORM `` has slow Reads and fast Create, Update & Delete operation
447
+ * ``SQLObject `` fails
448
+
449
+ PyPy comparison: MySQL
450
+ -----------------------
451
+ * ``peewee `` and ``Tortoise ORM `` gets a noticeable performance improvement
452
+ * ``Pony ORM `` is marginally faster
453
+ * ``SQLAlchemy ORM `` and ``Django `` is marginally slower
393
454
* ``SQLObject `` fails
394
455
395
456
0 commit comments